- #1
Alexandre
- 29
- 0
I have a second order differential equation of the form (theta is a function of time):
[itex] \theta ''=F\left(\theta ,\theta '\right) [/itex]
Turning them to two first order equations I get:
[itex] \begin{cases} \theta '\:=\omega \\ \omega '=F\left(\theta ,\omega \right) \end{cases} [/itex]
And here's the algorithm which I need to know whether it's correct or not:
It does give me a solution that is really close to first order approximation but the thing is, when I look at the phase space, first order approximation conserves energy better because curves are closer to being closed (the equation is non dissipative), so I'm wondering why is that. Second order approximation is supposed to be better.
[itex] \theta ''=F\left(\theta ,\theta '\right) [/itex]
Turning them to two first order equations I get:
[itex] \begin{cases} \theta '\:=\omega \\ \omega '=F\left(\theta ,\omega \right) \end{cases} [/itex]
And here's the algorithm which I need to know whether it's correct or not:
Given the initial conditions [itex] \theta _1 [/itex] and [itex] \omega _1 [/itex] run loop for [itex] n [/itex]
[itex] k_1=\omega _n [/itex]
[itex] k_2=\omega _n+\Delta t\cdot k_1 [/itex]
[itex] j_1=F\left(\theta _n,\omega _n\right) [/itex]
[itex] j_2=F\left(\theta _n+\Delta t\cdot j_1,\omega _n+\Delta t\cdot k_1\right) [/itex]
[itex] \theta _{n+1}=\theta _n+\frac{\Delta t}{2}\cdot \left(k_1+k_2\right) [/itex]
[itex] \omega _{n+1}=\omega _n+\frac{\Delta t}{2}\left(j_1+j_2\right) [/itex]
It does give me a solution that is really close to first order approximation but the thing is, when I look at the phase space, first order approximation conserves energy better because curves are closer to being closed (the equation is non dissipative), so I'm wondering why is that. Second order approximation is supposed to be better.