Integrating 2nd order ODE using midpoint rule


by Niles
Tags: integrating, midpoint, order, rule
Niles
Niles is offline
#1
Apr28-12, 04:43 AM
P: 1,863
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) \\
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.

Best,
Niles.
Phys.Org News Partner Science news on Phys.org
Going nuts? Turkey looks to pistachios to heat new eco-city
Space-tested fluid flow concept advances infectious disease diagnoses
SpaceX launches supplies to space station (Update)
djelovin
djelovin is offline
#2
Apr29-12, 03:47 PM
P: 26
Here you have it explained:
Computational physics

page 292, "13.4 More on finite difference methods, Runge-Kutta methods"
Niles
Niles is offline
#3
May4-12, 11:33 AM
P: 1,863
Thanks!


Register to reply

Related Discussions
Volume using midpoint rule Calculus & Beyond Homework 0
Fortran integration: Midpoint rule and Simpson's rule Programming & Computer Science 0
Midpoint rule Calculus & Beyond Homework 3
Midpoint Rule Confusion Calculus & Beyond Homework 2
Midpoint Rule for Integrals Calculus & Beyond Homework 1