------------------------------------------------------------------------------
""" % (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) )
#### Method 2
# http://docs.sympy.org/0.7.2/modules/matrices/matrices.html
# The vectorial function.
X = Matrix([R1 * cos(theta)**2 + (R1rho_p + ( (phi_ex * kex) / (kex**2 + we**2) ) ) * sin(theta)**2])
# What to derive for.
Y = Matrix([R1, theta, R1rho_p, phi_ex, kex, we])
# Make the Jacobian
Jacobian = X.jacobian(Y)
jac_string = str(Jacobian)
jac_string_arr = jac_string.replace("Matrix", "array")
print("""Form the Jacobian matrix by:
------------------------------------------------------------------------------
from numpy import array, cos, sin, pi, transpose
R1 = 1.1
theta = pi / 4
R1rho_p = 10.
phi_ex = 1100.
kex = 2200.
we = 3300.
jacobian_matrix_2 = %s
print jacobian_matrix_2
------------------------------------------------------------------------------
""" % (jac_string_arr) )
</source>
=== output ===
output