On Thu, Feb 26, 2009 at 12:32 AM, Mr Gerard Kelly <gerard.ke...@uqconnect.edu.au> wrote: > I am getting some very strange behaviour from the Linear Algebra module. > > Look at this code: > > from LinearAlgebra import * > > a=5 > print a > > And look at the output that I get when I run it: > > 50.0 > 0.0 > 0.25 > 0.0 > 0.5 > 0.0 > 0.75 > 0.0 > 1.0 > [[ 2.50000000e-01 -2.50000000e-01 -4.99993750e-01 ..., > 3.73459082e+01 3.75116710e+01 3.76764961e+01] > [ 5.00000000e-01 -5.00000000e-01 -6.25000000e-06 ..., > -4.99993797e-01 -2.49373966e-03 4.99993766e-01] > [ 7.50000000e-01 -7.50000000e-01 0.00000000e+00 ..., > -7.50000000e-01 0.00000000e+00 7.50000000e-01] > [ 1.00000000e+00 -1.00000000e+00 0.00000000e+00 ..., > -1.00000000e+00 0.00000000e+00 1.00000000e+00]] > 5 > > > Apparently Linear Algebra is giving me the output of another program along > with the output for this one. Of course I don't need Linear Algebra to print > the number 5, but I've been trying to make a program that uses Linear > Algebra, and I'm always having the output come out twice each time I run it. > When I edit the program, it always gives me the old output before the new > output, even if I edit it right down to something as simple as "a=5, print a".
Is this the LinearAlgebra package from Numeric? It's helpful if you don't assume we know what you are talking about :-) If so, shouldn't it be something like from Numeric.LinearAlgebra import * ? Anyway my guess is that you have another program called LinearAlgebra.py in your python path. *That* program probably has the correct import, but it also does some calculations and prints the result. Try this: import LinearAlgebra print LinearAlgebra.__file__ to find out what you are really importing. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor