Quantcast
Channel: Converting sympy Jacobian back to numpy - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Converting sympy Jacobian back to numpy

$
0
0

I have a list of "n" sympy functions of which the Jacobian is calculated for the list of symbols "jlist":

from sympy import symbols, zerosjlist = symbols('sj0:%d'%n)Fa = zeros(n,1)Fa[0] = jlist[0]+jlist[2]Fa[1] = 2*jlist[1]...Fa[-1] = 3*jlist[-1]JFa = Fa.jacobian(jlist)

The Jacobian will be sparse and since some of the functions are nonlinear, it will contain symbols. Now I would like to convert Fa and JFa into numpy arrays. What is the best way to do this?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images