On 05/04/2010 10:32 AM, janwillem wrote: > I need some explanation on the workings of SymPy. As an example the > following script: > import sympy > X, F, B = sympy.symbols('XFB') > Y = X / F - B #eqn 1 > DY = sympy.Matrix(sympy.diff(Y, (X, F, B))).T > Do sympy.diff(Y, (X, F, B), evaluate=True) instead for now. But you're right - this shouldn't be necessary. Somehow the vectorization of the diff method seems to fail and set evaluate to False. > print DY > > I had expected (eqn 2): [1/F, -X/F**2, -1] > But get: [D(-B + X/F, X), D(-B + X/F, F), D(-B + X/F, B)] > > Not after doing a trick of which I cannot remember why I tried it, I > get the desired result > DY = DY.subs({X:X, F:F, B:B}) > This works because subs evaluates the expression in the end (which wasn't done before). > From the doc I had thought that DY.doin() would work but that gives > "raise AttributeError()". > First, the name of the method is doit. Second, DY is a python tuple which doesn't have this method. > So there is obviously something I do not understand, please some help > Janwillem > > Sebastian
-- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.