1

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.

Lutz Lehmann
  • 126,666
  • Try and reduce them to first order by introducing new variables. For example $y''=-2xy$, let $y'=v$ and $v'=-2xy$ – Jepsilon Jun 09 '18 at 13:44
  • 1
    Think that $r''=f_1(r,r',\cdots)\equiv \dot r_1= r_2,\dot r_2 = f_1(r_1,r_2,\cdots)$ – Cesareo Jun 09 '18 at 13:44
  • Remember odeint only solves first order systems so this procedure is essential assuming you want the actual function not the first derivative – Jepsilon Jun 09 '18 at 13:45
  • 1
    Upon inspection, your link seems to be done fine. Is it giving any errors that could be helpful to know about? – Jepsilon Jun 09 '18 at 13:51

0 Answers0