Also Faisal just opened a pull request implementing this: https://github.com/sympy/sympy/pull/19703
Does that look like what you expected? Feel free to comment on the pull request if you have any suggestions. Oscar On Sat, 4 Jul 2020 at 14:24, Kasper Peeters <kasper.peet...@phi-sci.com> wrote: > > >> Is there a way to compute the gradient and hessian matrices of a vector >> field like u = (x) i + (2yz) j + (3xy) k. > > > I know you didn't ask for this, but just in case it is of any help, here's > how you do it in Cadabra (https://cadabra.science). > Cadabra uses Sympy under the hood, so it's at least a partial Sympy answer. > > Set-up with: > > {x,y,z}::Coordinate; > {i,j,k,l}::Indices(values={x,y,z}); > \partial{#}::PartialDerivative; > rl:= { u_{x} = x, u_{y} = 2 y z, u_{z} = 3 x y }; > > The gradient can then be computed using: > > grad:= g_{i j} = \partial_{i}{ u_{j} }; > evaluate(grad, rl, rhsonly=True); > > and the Hessian with: > > H:= H_{i j k} = \partial_{i j}{ u_{k} }; > evaluate(H, rl, rhsonly=True); > > Hope this helps. > > Kasper > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/6f06c7ac-46d7-499f-af4d-392e9399be24o%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxTtBAHehstAvb-hc7SAGj98oL3wP%2B5fddwH5PMphyXa%2Bg%40mail.gmail.com.