4th order RK to solve 2nd order ODE

Kanashii
Messages
9
Reaction score
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
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.
 
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.
 
Some of the ' need to be outside of the [ SUB] ' [/SUB]
 
epenguin said:
Some of the ' need to be outside of the [ SUB] ' [/SUB]
I moved them, so it should be OK now.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top