How to Apply Runge-Kutta to Solve a Simple Motion Problem

Click For Summary

Discussion Overview

The discussion revolves around applying the Runge-Kutta (RK4) integration method to solve a simple motion problem involving a car with constant acceleration. Participants explore the formulation of the problem as a system of differential equations and seek to understand the application of the RK4 technique step-by-step.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant requests assistance in applying the RK4 method to a problem involving a car's motion with given acceleration and initial conditions.
  • Another participant suggests that the problem is trivial and may not serve as a good example for RK application.
  • A participant emphasizes the need to express the second-order differential equation as a system of first-order equations to apply RK4 effectively.
  • One participant provides the RK4 formula and explains how to set up the equations for position and velocity based on the given acceleration.
  • Another participant outlines the RK4 steps for calculating position and velocity at specific time intervals, demonstrating the calculations for t=1.

Areas of Agreement / Disagreement

Participants express differing views on the suitability of the problem for demonstrating the RK4 method. While some acknowledge its triviality, others seek detailed guidance on applying the method despite this. The discussion remains unresolved regarding the appropriateness of the example for learning RK4.

Contextual Notes

Participants note that the original second-order differential equation must be reformulated into a system of first-order equations, which introduces additional complexity in the application of the RK4 method.

scorp007
Messages
5
Reaction score
0
Hi,

Could someone please show me how to solve the following simple problem using the Runge-Kutta (RK4) integration method?

A car at t=0 has acceleration 10m/s/s, velocity 0m/s.
How far would the car travel in 10 seconds?

I know this can be solved using the equations of motion (giving an answer of 500m) but I'm trying to understand how to apply Runge-Kutta to this problem.


Thanks for your attention.
 
Physics news on Phys.org
First you need to express your problem as a differential equation.

In your case that is:

[tex]\ddot {x} = c[/tex]

I think that you will find that this is a trivial system and not a good example of how to apply RK.
 
I understand the problem is a trivial one, especially to integrate the acceleration to find velocity, but would you mind showing me how to apply the RK4 technique to this simple problem so I can understand it better?
 
What have you done before asking us here for help? I googled "Runge Kutta" and got 1,040,000 hits. The first two at http://mathworld.wolfram.com/Runge-KuttaMethod.html" are both well-written.

Integral said:
First you need to express your problem as a differential equation.

[tex]\ddot {x} = c[/tex]

None of the RK methods use the second derivative. Any second-order problem can be reformulated as a first-order problem, in this case

[tex]\vect x = \bmatrix r \\ v \endbmatrix[/tex]
[tex]\vect x(0) &= \bmatrix 0 \\ 0 \endbmatrix[/tex]
[tex]\dot {\vect x} &= \bmatrix v \\ 10 \endbmatrix[/tex]
where [itex]r[/itex] is the position of the car and [itex]v[/itex] is its velocity.
 
Last edited by a moderator:
Thanks for the tip. I have already done a google search and looked at both mathworld and wikipedia. Using the basic Euler integration method, I would simply integrate acceleration to get velocity at a particular instance of time and then use the value I obtain to further integrate and find position.

I guess what I'm after is an example of the steps for at least a few values of t so I can see how you get from acceleration to position and what needs to be plugged in where (some of the notation is slightly confusing). If you would be so kind as to perform the runge-kutta technique for t=1 and t=2 to find both the velocity and position at those points, I would be very grateful for the assistance.Thanks.
 
If you did a google search then you surely must have seen the formula:

xn+1 = xn + h⁄6 (a + 2 b + 2 c + d)
where
a = f (tn, xn)
b = f (tn + h⁄2, xn + h⁄2 a)
c = f (tn + h⁄2, xn + h⁄2 b)
d = f (tn + h, xn + h c)

for the 4th order Runge-Kutta method.

As Integral said, you need to convert your second order equation into a system of two first order equations: If you let v= x' then x"= v'= c so your two equations are x'= v and v'= c. Now do two parallel RungeKutta Calculations. The "f" for x'= v is f(t,x,v)= v and for v'= c f(t,x,v)= c, a constant. Assuming that your initial values are x(0)= 0 and v(0)= 0 then, again, for the equation x'= v ax = f (tn, xn, vn)= f(0,0,0)= 0 while for v'= c, av= f(0,0,0)= c so
bx = f (tn + h⁄2, xn + h⁄2 ax, vn+ h/2 av)= 0+ hc/2= hc/2 and
bv= f(tn+ h/2, xn+ h/2 ax,vn+h/2 av)= c

cx = f (tn + h⁄2, xn + h⁄2 bx,vn+ h/2 bv)= 0+ h/2 (c)= hc/2 and
cv= c

dx = f (tn + h, xn + h cx,vn+ h cv) = hc/3 and dv= c again.

Then x1= x(h)= 0 + h⁄6 (0 + 2 hc/2 + 2 hc/2 + hc/2)= 5h2c/12 and v1= v(h)= h/6(c+ 2c+ 2c+ c)= hc.
 
In this case (and in many problems), the state time derivative does not depend
directly on time:
[tex]f(t,x) = \dot {\vect x}(t) = \bmatrix v(t) \\ 10 \endbmatrix[/tex]

Taking your simple problem from t=0 to t=1 ([itex]h = \Delta t = 1[/itex]),
[tex]\vect x_0 = \bmatrix 0 \\ 0 \endbmatrix[/tex]
[tex]\vect k_1 = f(0,\vect x_0) = \bmatrix 0 \\ 10 \endbmatrix[/tex]
[tex]\vect x_1 = \vect x_0 + \frac{\Delta t}{2}\vect k_1<br /> = \bmatrix 0 \\ 5 \endbmatrix[/tex]
[tex]\vect k_2 = f(1/2,\vect x_1) = \bmatrix 5 \\ 10 \endbmatrix[/tex]
[tex]\vect x_2 = \vect x_0 + \frac{\Delta t}{2}\vect k_2<br /> = \bmatrix 2.5 \\ 5 \endbmatrix[/tex]
[tex]\vect k_3 = f(1/2,\vect x_2) = \bmatrix 5 \\ 10 \endbmatrix[/tex]
[tex]\vect x_3 = \vect x_0 + \Delta t\vect k_3<br /> = \bmatrix 5 \\ 10 \endbmatrix[/tex]
[tex]\vect k_4 = f(1,\vect x_3) = \bmatrix 10 \\ 10 \endbmatrix[/tex]

[tex]\vect x(1) = \vect x(0) +<br /> \frac{\Delta t}6 (\vect k_1 + 2 \vect k_2 + 2 \vect k_3 + \vect k_4)<br /> = \bmatrix 0 \\ 0 \endbmatrix +<br /> \frac 1 6<br /> \left(\bmatrix 0 \\ 10 \endbmatrix +<br /> 2 \bmatrix 5 \\ 10 \endbmatrix +<br /> 2 \bmatrix 5 \\ 10 \endbmatrix +<br /> \bmatrix 10 \\ 10 \endbmatrix\right)<br /> = \bmatrix 5 \\ 10 \endbmatrix[/tex]
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 65 ·
3
Replies
65
Views
9K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K