How to solve with Python a non-linear system of differential equation at order 2?

625 Views Asked by At

I need to solve the following equation with Python : \begin{align} r''&=f_{1}(r,r',\theta, \theta',\phi,\phi') \\ \theta''&=f_{2}(r,r',\theta,\theta',\phi,\phi') \\ \phi''&=f_{3}(r,r',\theta,\theta',\phi,\phi') \end{align} $f_{1},f_{2},f_{3}$ are non-linear (including trigonometric functions, exponential etc..) i tried to use the function odeint from scipy.integrate, but it requires a function at first argument and i don't know how to build it.

I have build the following fonction but it doesn't seem to be correct. I have build the following fonction but it doesn't seem to be correct

It takes in entry the 6 arguments of $(r,r',\theta, \theta',\phi,\phi')$ and t a numpy.array that contains the number of point that odeint will solve

It returns $(r',r'',\theta', \theta'',\phi',\phi'')$

Could someone explain me how to build for odeint a function of a system of non linear differential equation at order 2 ? Or point me the fault that contain my python function ?

Thank you all in advance for your help, I deeply appreciate it.