Open main menu

Changes

DPL94 derivatives

254 bytes added, 09:06, 1 September 2014
== Jacobian ==
=== sympy ===
<source lang="python">
from sympy import *
print("""Form the Jacobian matrix by:
------------------------------------------------------------------------------
from numpy import array, cos, sin, pi, transpose R1 = 1.1theta = pi / 4R1rho_p = 10.phi_ex = 1100.kex = 2200.we = 3300. 
d_f_d_R1 = %s
d_f_d_theta = %s
d_f_d_we = %s
jacobian_matrix = transpose(array( [d_f_d_R1 , d_f_d_theta, d_f_d_R1rho_p, d_f_d_phi_ex, d_f_d_kex, d_f_d_we] ) )
 
print jacobian_matrix
------------------------------------------------------------------------------
""" % (d_f_d_R1, d_f_d_theta, d_f_d_R1rho_p, d_f_d_phi_ex, d_f_d_kex, d_f_d_we) )
</source>
=== output ===
output
<source lang="python">
from numpy import array, cos, sin, pi, transpose R1 = 1.1theta = pi / 4R1rho_p = 10.phi_ex = 1100.kex = 2200.we = 3300. 
d_f_d_R1 = cos(theta)**2
d_f_d_theta = -2*R1*sin(theta)*cos(theta) + 2*(R1rho_p + kex*phi_ex/(kex**2 + we**2))*sin(theta)*cos(theta)
d_f_d_we = -2*kex*phi_ex*we*sin(theta)**2/(kex**2 + we**2)**2
jacobian_matrix = transpose(array( [d_f_d_R1 , d_f_d_theta, d_f_d_R1rho_p, d_f_d_phi_ex, d_f_d_kex, d_f_d_we] ) )
 
print jacobian_matrix
</source>