i found that ModelingToolkit.calculate_jacobian()
function symbolically generates Jacobian of ODESystem in MTK docs.
How does one substitute numerical values of parameters and state varables numerical values in this matrix to evaluate ?
1 Like
Try Symbolics.substitute
thanks @baggepinnen
i am doing currently following
x₀map = states(odesys) .=> x0
pmap = parameters(odesys) .=> ps
jac = substitute.( ModelingToolkit.calculate_jacobian(odesys), (Dict([x₀map;pmap]),) )
jac = Symbolics.value.(jac)
Hope i am doing this right!
Looks about right to me, just make sure the states and parameters are returned in the order you expect.