Hello Amit,
The line of code you have given is not clear. Could you give a more
concrete example of a functionality that you're expecting ?

If you want to calculate the hessian of a function, Sympy has a
hessian function which takes in a function and a list of variables of
the function, and returns the hessian matrix of size m * m, where m is
number of variables.

In [4]: f = x**2*y

In [5]: f
Out[5]:
 2
x ⋅y

In [6]: syms = [x,y]

In [7]: hessian(f, syms)
Out[7]:
⎡2⋅y  2⋅x⎤
⎢        ⎥
⎣2⋅x   0 ⎦

As to about other matrix calculus functions, it would help if you
could show what exactly do you want along with the corresponding
output you expect.

-Sherjil Ozair

On Jun 30, 7:10 am, Amit <amiti...@gmail.com> wrote:
> Hi,
>
> I am studying machine learning and lately I had to do some matrix
> calculus. I am using the 'The Matrix cookbook' to calculate things
> like the gradient and hessian of expressions like:
>
>  {Z \alpha}^T (Z^T diag(\alpha) Z - ...)^{-1} Z \alpha
>
> where Z is a matrix and alpha a vector. This can get pretty ugly and
> tedious when done by hand.
> I looked for some automatic way to do this i.e. a CAS, but didn't find
> any (I am looking for something that can do this symbolically and not
> numerically).
> I was wandering why is it so. Is it too complicated? or maybe its not
> well defined?
>
> Thanks,
> Amit

-- 
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 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to