Integrating 2nd order ODE using midpoint rule

Click For Summary
SUMMARY

The discussion focuses on integrating second-order ordinary differential equations (ODEs) using the midpoint rule, specifically in the context of Newton's equations of motion. The user initially implemented an Euler method for updating velocity and position but seeks to enhance accuracy through the second-order Runge-Kutta method. The confusion arises in applying the midpoint rule, particularly in determining the function f for the update equations. References to external resources, including efunda.com and a teaching document from the University of Zagreb, provide additional guidance on finite difference methods.

PREREQUISITES
  • Understanding of Newton's laws of motion
  • Familiarity with numerical methods for ODEs
  • Knowledge of the Euler method for integration
  • Basic concepts of the Runge-Kutta method
NEXT STEPS
  • Study the implementation of the second-order Runge-Kutta method in numerical simulations
  • Review the derivation of the midpoint rule for ODE integration
  • Explore advanced numerical methods for solving differential equations
  • Examine practical applications of ODE integration in physics simulations
USEFUL FOR

Students and professionals in physics, computational physics, and applied mathematics who are working on numerical integration of differential equations, particularly those interested in improving the accuracy of simulations involving motion dynamics.

Niles
Messages
1,834
Reaction score
0
Hi

I am trying to integrate Newtons equations for my system
[tex] a = \frac{F}{m} = \frac{d^2x}{dt^2}[/tex]
This is only for the first coordinate of the particle. I wish to do it for y and z as well, but let us just work with x for now to make it simple.

The force in the x-direction depends on the velocity in the x-direction, vx, and the y- and z-coordinate. In other words
[tex] F=F(v_x, y, z)[/tex]
Now, I wish to solve this equation, and I have currently implemented an Euler method. This is how I iterate
[tex] v_{n+1} = v_n + dt\cdot a(v_{x,n},y_n,z_n) \\<br /> x_{n+1} = x_{n} + dt\cdot v_{n}[/tex]
I now want to improve the error, and use a 2nd order Runge-Kutta method, i.e. the midpoint rule as briefly summarized here: http://www.efunda.com/math/num_ode/num_ode.cfm

I am not quite sure how to do this. In the link they say that now I should generally write
[tex] y_{n+1} = y_{n} + dt\cdot f(x_n + dt/2, y_n + k_1/2)[/tex]
where
[tex] k_1 = dt\cdot f(x_n, y_n).[/tex]
This is where my confusion arises: What does [itex]f(x_n + dt/2, y_n + k_1/2)[/itex] correspond to for me?

I would really appreciate a hint or two with this.


Niles.
 
Physics news on Phys.org
Here you have it explained:
http://www.phy.pmf.unizg.hr/~npaar/teaching/compphys.pdf

page 292, "13.4 More on finite difference methods, Runge-Kutta methods"
 
Thanks!
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K