Ondrej Certik wrote: > Let's clean this up. I sent an email to the numpy-list asking for an advice: > > http://projects.scipy.org/pipermail/numpy-discussion/2008-June/034801.html
I agree with Robert Kern's view that sympy.Matrix should not be tied to numpy.matrix - the latter in numpy has a limited use basically in cases one is lazy to write dot( A.T, B ) instead of A * B (:-}). Sympy is about math, so sympy.Matrix could become a real matrix in the mathematical sense. > The ultimate reason that Matrix is not a subclass of a Basic is that > it is mutable, while SymPy objects need to be immutable, so that when > you have an expression, like (1+x)**2, you can be sure that all the > instances (like "x") doesn't change in the middle of a calculation. > > Q: Why is a Matrix mutable? > A: Because we want to play with matrices using the natural syntax: > A[0,0] = x**2, etc. > > Q: Do we want to use Matrices in expressions? > A: I think it could be very useful. Currently we can use Symbol("A", > commutative=False), but it'd be nice to have an option to "attach" > some matrix for it, that represents it. Also it will make the whole > SymPy cleaner, if we adapt for example this approach: > > Make Matrix immutable, while introducing an Array class, that will > behave like numpy array, be mutable etc., and a 2D array could be > converted to Matrix (and back of course), thus Matrices would become > regular SymPy objects. > > Disadvantage -- if one needs to set entries of a Matrix using the > syntax "A[1, 2] = y" not only at the beginning of the calculaton, but > also in the middle, then he would have to do: A = Matrix(Array(A)[1,2] > = y). Of course A[1,2] = y would create an exception saying: "use the > A = Matrix(Array(A)[1,2] = y)" syntax. By the "beginning of the calculation" you mean that the assignement A[i,j] = value will work only once after an empty A is created? > What do you think? Fine! r. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---