Yes a typo. Dyslexia doesn't always come in handy.
I think that using jacobian is the elegant solution.
The not evaluating the diff is essentially only an issue when I wanted
to texify the intermediate results of a derivation and compare with
the original publication.
Now everything works and after lambdify my script works like a charm.
Thanks, Janwillem

On May 4, 4:47 pm, b45ch1 <sebastian.wal...@gmail.com> wrote:
> May I ask in what context you require the matrix derivatives.
> Depending on what you are after an Algorithmic Differentiation (AD)
> tool could also be a viable alternative.
>
> With an AD tool you could differentiate functions (i.e. compute
> gradient, Jacobian, Hessian, higher order tensors) very easily and
> efficiently.
>
> An example of what functions are possible:
>
> def f(A,x):
>     for n in range(30):
>         y = dot(x.T,dot(A,x))
>         A = inv(A) - dot(x,x.T) * y
>
>     return trace(A)
>
> best regards,
> Sebastian
>
> On May 4, 10:32 am, janwillem <jwevand...@xs4all.nl> 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 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})
> > From the doc I had thought that DY.doin() would work but that gives
> > "raise AttributeError()".
> > So there is obviously something I do not understand, please some help
> > Janwillem
>
> > --
> > 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 
> > athttp://groups.google.com/group/sympy?hl=en.
>
> --
> 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 
> athttp://groups.google.com/group/sympy?hl=en.

-- 
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.

Reply via email to