Talk:Permutations by swapping: Difference between revisions

(→‎Does "Python: recursive" fit this task?: successive items by a swap between two items plus give the sign.)
(→‎Python code issues: new section)
Line 30:
 
: It can be used directly in the formula there for calculating a determinant using the sign and the permutations. (But, from the talk page, you don't have to use any particular algorithm) --[[User:Paddy3118|Paddy3118]] 15:56, 30 July 2012 (UTC)
 
== Python code issues ==
 
Several of them:
# The whole thing makes no sense. You don't want a O(n!) algorithm for determinant when there's a polynomial one, so it's odd one should bear matrices in mind, especally when dealing with a slow language like Python. Try a say, 12x12 matrix, and watch yourself die of old age before it finishes.
# Saving code here as spermutations.py and run the code in [[Matrix arithmetic]], it will say "TypeError: 'int' object is not iterable" (python 2) or "if DEBUG: print ' #', p SyntaxError" (python 3). Disregarding the latter, probably line 19 in code over there should have said <code>s = list(spermutations(r))</code>?
# Change that, and now code blows up on line 35 in spermutations.py. The 'n' here should be 'n1', maybe?
# Change ''that'', now <code>det([ range(5) for _ in range(5) ])</code> doesn't seem to return, ever. Maybe it's just Python being slow? (no not really).
# Replace the main section of spermutations.py with <code>for x in spermutations(range(3)): print(x)</code>, and run it. How many lines should it produce?
--[[User:Ledrug|Ledrug]] 19:27, 4 August 2012 (UTC)
Anonymous user