Is this correct second order approximation?

Alexandre
Messages
29
Reaction score
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:
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.
 
Physics news on Phys.org
Is this Heun's method? I think it would go something like this given ##\theta_0,\,\omega_0##:

$$
\theta' = \omega = F_1(t,\theta) \\
\theta'' = \omega ' = F_2(t,\theta,\theta') \\
\\
k_1 = \theta_i + \Delta t F_1(t_i,\theta_1) \\
\theta_{i+1} = \theta_i + \frac{\Delta t}{2} \left [ F_1(t_i,\theta_i) + F_1(t_{i+1},k_1) \right ] \\
j_1 = \omega_i + \Delta t F_2(t_i,\theta_i,\omega_i) \\
\omega_{i+1} = \omega_i + \frac{\Delta t}{2} \left [ F_2(t_i,\theta_i,\omega_i) + F_2(t_{i+1}, \theta_{i+1}, j_1) \right ]
$$
 
Yes it's Heun's method, a.k.a. two stage Runge–Kutta method. In my case F is time independent.

I don't seem to understand what F1 and F2 are in your algorithm.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 0 ·
Replies
0
Views
5K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 65 ·
3
Replies
65
Views
10K
  • · Replies 3 ·
Replies
3
Views
3K