[sympy] partial derivatives, please explain

2010-05-04 Thread janwillem
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 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 +

Re: [sympy] partial derivatives, please explain

2010-05-04 Thread Bastian Weber
Hi Jan, 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 > print DY > > I had expected (eqn 2): [1/F, -X/F**2, -1] > But

Re: [sympy] partial derivatives, please explain

2010-05-04 Thread Sebastian
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) i

Re: [sympy] partial derivatives, please explain

2010-05-04 Thread Bastian Weber
janwillem wrote: > Thanks for the explanation. I moved the doit()s to later in the script > where everything boils down to scalars and that works. > > I had tried jacobean but sometimes that gives me AttributeError. Here > is the real thing I was working on: > > def lpu_nonlin(Y, X, C): > """

Re: [sympy] partial derivatives, please explain

2010-05-04 Thread Aaron S. Meurer
On May 4, 2010, at 4:25 AM, Sebastian wrote: > 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