4th order RK to solve 2nd order ODE

In summary, the homework statement is to consider the initial value problem x" + x′ t+ 3x = t; x(0) = 1, x′(0) = 2 and convert it to a system of two first order equations. The attempted solution uses two linear ODEs to find approximate values of the solution at t=0.5 and t=1.0.
  • #1
Kanashii
9
0

Homework Statement


Consider the initial value problem x" + x′ t+ 3x = t; x(0) = 1, x′(0) = 2 Convert this problem to a system of two first order equations and determine approximate values of the solution at t=0.5 and t=1.0 using the 4th Order Runge-Kutta Method with h=0.1.

Homework Equations


yn+1 = yn + 1/6 ( k1 + 2k2 + 2k3 + k4)
k1 = h* f(xn, yn)
k2 = h* f(xn + 1/2 h, yn + 1/2 k1)
k3 = h* f(xn + 1/2 h, yn + 1/2 k2)
k4 = h* f(xn+1, yn+k3)

The Attempt at a Solution


I tried to convert the equation into two linear ODEs:

x = x1
x′= x1' = x2
x′′= x1'' = x2'

x2' = -x2 t + t - 3x1 (first linear ODE)
x1' = x2 (second linear ODE)

I do not know what to do from here.
From 4th Order RK equations, I do not know what f(xn, yn) is.
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
The Runge-Kutta method give the solution to the differential equation:
$$x'(t)=f(x,t)$$

This can also be generalized to several equations by allowing ##x(t)## and ##f(x,t)## being vectors, i.e. ##x=(x_1,x_2,...,x_n)## and ##f=(f_1,f_2,...,f_n)##. So, in your case ##f=(f_1,f_2)## is a two-dimensional array containing the right-hand side of each equation.

By the way, I recommend that you use Latex to write your equations. In your post it is difficult to read them.
 
  • #3
Kanashii said:

Homework Statement


Consider the initial value problem x" + x′ t+ 3x = t; x(0) = 1, x′(0) = 2 Convert this problem to a system of two first order equations and determine approximate values of the solution at t=0.5 and t=1.0 using the 4th Order Runge-Kutta Method with h=0.1.

Homework Equations


yn+1 = yn + 1/6 ( k1 + 2k2 + 2k3 + k4)
k1 = h* f(xn, yn)
k2 = h* f(xn + 1/2 h, yn + 1/2 k1)
k3 = h* f(xn + 1/2 h, yn + 1/2 k2)
k4 = h* f(xn+1, yn+k3)

The Attempt at a Solution


I tried to convert the equation into two linear ODEs:

x = x1
x′= x1′ = x2
x′′= x1′′ = x2′

x2′ = -x2 t + t - 3x1 (first linear ODE)
x1′ = x2 (second linear ODE)

I do not know what to do from here.
From 4th Order RK equations, I do not know what f(xn, yn) is.

See
http://math.stackexchange.com/quest...-order-method-on-a-system-of-2-first-order-od
for a detailed explanation plus worked example.

BTW: I do not agree that your work is difficult to read; in fact, it reads surprisingly well and looks quite good. However, post #2 is correct in suggesting the use of LaTeX; you would find it much easier and faster than constantly using the [ S U B] ... [/ S U B] construction, and it wold look even better than what you have already.
 
  • #4
Some of the ' need to be outside of the [ SUB] ' [/SUB]
 
  • #5
epenguin said:
Some of the ' need to be outside of the [ SUB] ' [/SUB]
I moved them, so it should be OK now.
 

FAQ: 4th order RK to solve 2nd order ODE

What is a 4th order Runge-Kutta method?

A 4th order Runge-Kutta (RK) method is a numerical technique used to solve ordinary differential equations (ODEs). It is a higher-order method, meaning it is more accurate than lower-order methods such as Euler's method. It is commonly used to solve 2nd order ODEs.

How does a 4th order RK method work?

A 4th order RK method works by approximating the solution to an ODE at discrete time steps. It uses a weighted average of four different estimates of the slope at each time step to improve the accuracy of the solution. This method is also known as the "classical Runge-Kutta method" or "RK4".

Why is a 4th order RK method preferred over lower-order methods?

A 4th order RK method is preferred over lower-order methods because it provides a more accurate approximation of the solution with fewer time steps. This means that it can solve ODEs more efficiently and with less computational effort. Additionally, RK4 has a global error that is proportional to the 5th power of the step size, making it significantly more accurate than lower-order methods.

What are the limitations of using a 4th order RK method?

One limitation of using a 4th order RK method is that it can become unstable for certain types of ODEs. This can happen when the step size is too large or when the ODE has a stiff nature. Additionally, RK4 is not suitable for solving ODEs with discontinuous or highly oscillatory solutions.

How can a 4th order RK method be implemented to solve 2nd order ODEs?

To use a 4th order RK method for solving a 2nd order ODE, the ODE must first be converted into a system of two 1st order ODEs. This can be done by introducing a new variable and writing the 2nd order ODE as a first-order system. Once this is done, the RK4 method can be applied to the system of equations to approximate the solution at discrete time steps.

Similar threads

Back
Top