Re: [sympy] Re: How to compute the gradient and Hessian of a vector field symbolically with sympy.

2020-07-04 Thread Oscar Benjamin
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 wrote: > > >> Is there a way to

Re: [sympy] warning: from sympy import * is deprecated

2020-07-04 Thread Volker Weißmann
Hi Oscar, using sympy.S.Zero does silence the warning, but isinstance(somevar, sympy.S.Zero) does not work, because sympy.S.Zero is not the class but an object. How do I get the class Zero? Greetings Volker On 7/3/20 5:29 PM, Oscar Benjamin wrote: Hi Volker, The problem is that you

[sympy] Re: How to compute the gradient and Hessian of a vector field symbolically with sympy.

2020-07-04 Thread Kasper Peeters
> 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

Re: [sympy] warning: from sympy import * is deprecated

2020-07-04 Thread Volker Weißmann
Thank you, type(sympy.S.Zero)  seems to work. On 7/4/20 5:17 PM, Oscar Benjamin wrote: On Sat, 4 Jul 2020 at 16:05, Volker Weißmann wrote: using sympy.S.Zero does silence the warning, but isinstance(somevar, sympy.S.Zero) does not work, because sympy.S.Zero is not the class but an object.

Re: [sympy] warning: from sympy import * is deprecated

2020-07-04 Thread Oscar Benjamin
On Sat, 4 Jul 2020 at 16:05, Volker Weißmann wrote: > > using sympy.S.Zero does silence the warning, but isinstance(somevar, > sympy.S.Zero) does not work, because sympy.S.Zero is not the class but > an object. How do I get the class Zero? You can do `type(S.Zero)` to get the class. Normally

[sympy] Re: How to compute the gradient and Hessian of a vector field symbolically with sympy.

2020-07-04 Thread Nicolas Guarin
You could also use a package that I wrote for that purpose https://continuum-mechanics.readthedocs.io/en/latest/ If you are interested in Cartesian coordinates only you could just do the following u = Matrix([x, 2*y*z, 3*x*y]) J = u.jacobian([x, y, z]) H = Array([J[:, k].jacobian([x, y, z])

Re: [sympy] How to compute the gradient and Hessian of a vector field symbolically with sympy.

2020-07-04 Thread Faisal Riyaz
Hi Isaque, The vector module has a gradient function but it works only for scalar fields. There is an implementation given in this issue . Unfortunately, it has not been merged. The hessian function in the matrices module also works for scalars only.