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 at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to