Runge-Kutta for sovling 2nd ODE

In summary, the conversation discusses the application of the Runge-Kutta (RK4) integration method to solve a second order differential equation. It is suggested to introduce a new variable, v=tw', and rewrite the problem as a first order differential system involving v and w. The computed solution for h=1/10 is mentioned, and the importance of understanding Runge-Kutta is emphasized. The conversation also clarifies a misunderstanding regarding the problem and gives a general approach to applying Runge-Kutta to second order equations. The initial values for the problem are also provided.
  • #1
hsong9
80
1
Hi,

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

(tw')' + tw = 0 with w(0) = 1, w'(0) = 0 on the interval [0,1]
by introducing the new variable v=tw' and considering the resulting first order differential system involving w and v
computed solution (wh(1),vh(1)) for h=1/10.


I'm trying to understand how to apply Runge-Kutta to this problem.


Thanks for your attention.
 
Physics news on Phys.org
  • #2
If you let v= tw' then your problem becomes v'+ v= 0 or v'= -v with v(0)= 0. Now, what exactly is your question? What do you know about "Runge-Kutta"?
 
  • #3
HallsofIvy said:
If you let v= tw' then your problem becomes v'+ v= 0 or v'= -v with v(0)= 0.
Not quite. The problem become v'+tw=0. v is not tw. It is tw'.
 
  • #4
Ah, I misread the problem!

hSong9, the standard way of applying Runge-Kutta, or any numerical method for first order de's to second order is to rewrite the problem as two first order problems.

The differential equation is tw''+ w'+ tw= 0. If you let u= w' then w''= u' so the equation becomes tu'+ u+ tw= 0 or tu'= -u- tw. We also, of course, have w'= u so we have two first order equations for u and w. Run two simultaneous Runge-Kutta solvers for the two first order equations, at each step using the currrent values you have for both u and w in the formulas.

Your initial values, of course, will be w(0)= 1, w'(0)= u(0)= 0.
 
  • #5


Sure, I'd be happy to explain how to use Runge-Kutta (RK4) to solve this 2nd order differential equation. First, let's rewrite the equation in its standard form:

w'' + (1/t)w = 0

Now, we can introduce the new variable v = tw', as suggested. This gives us the following system of two first order differential equations:

w' = v/t
v' = -w/t

Next, we can use RK4 to numerically solve this system over the interval [0,1] with a step size of h = 1/10. The general RK4 formula for solving a first order differential equation is:

y_n+1 = y_n + (1/6)*(k1 + 2*k2 + 2*k3 + k4)

where k1, k2, k3, and k4 are calculated as follows:

k1 = hf(t_n, y_n)
k2 = hf(t_n + h/2, y_n + k1/2)
k3 = hf(t_n + h/2, y_n + k2/2)
k4 = hf(t_n + h, y_n + k3)

In our case, we have two equations, so we will use this formula twice, once for w and once for v. Here is the specific implementation for our problem:

w_n+1 = w_n + (1/6)*(k1w + 2*k2w + 2*k3w + k4w)
v_n+1 = v_n + (1/6)*(k1v + 2*k2v + 2*k3v + k4v)

where:

k1w = h*v_n/t_n
k2w = h*(v_n + k1v/2)/(t_n + h/2)
k3w = h*(v_n + k2v/2)/(t_n + h/2)
k4w = h*(v_n + k3v)/(t_n + h)

k1v = -h*w_n/t_n
k2v = -h*(w_n + k1w/2)/(t_n + h/2)
k3v = -h*(w_n + k2w/2)/(t_n + h/2)
k4v = -h*(w_n + k3w)/(t_n +
 

1. What is the Runge-Kutta method for solving 2nd order differential equations?

The Runge-Kutta method is a numerical method used to solve ordinary differential equations (ODEs). It is particularly useful for solving 2nd order ODEs, which involve second derivatives of the dependent variable with respect to the independent variable. The method involves breaking down the ODE into smaller steps and calculating the value of the dependent variable at each step, resulting in an approximate solution to the ODE.

2. How does the Runge-Kutta method differ from other numerical methods for solving ODEs?

The Runge-Kutta method is a higher-order method, meaning it uses more information from the ODE to approximate the solution at each step compared to lower-order methods like Euler's method. This results in a more accurate solution with fewer steps. Additionally, the Runge-Kutta method is self-starting, meaning it does not require an initial estimate of the solution like other methods.

3. What are the advantages of using the Runge-Kutta method?

The Runge-Kutta method is a versatile and robust method for solving ODEs. It can handle a wide range of ODEs, including stiff equations that may cause other methods to fail. It also has a high accuracy and efficiency, making it a popular choice for scientific and engineering applications.

4. Are there any limitations to using the Runge-Kutta method?

One limitation of the Runge-Kutta method is that it requires the ODE to be smooth and continuous. If the ODE has discontinuities or sharp changes, the method may produce inaccurate results. Additionally, the Runge-Kutta method can become computationally expensive for very small step sizes or for solving ODEs with a large number of variables.

5. How can I implement the Runge-Kutta method for solving 2nd order ODEs?

There are many resources available online that provide step-by-step instructions for implementing the Runge-Kutta method in various programming languages. Some popular options include MATLAB, Python, and C++. It is important to understand the algorithm and its parameters before attempting to implement it. Additionally, there are many software packages and libraries that already have the Runge-Kutta method implemented, so it may be more efficient to use one of these instead of creating your own implementation.

Similar threads

Replies
6
Views
114
  • Differential Equations
Replies
6
Views
2K
  • Differential Equations
Replies
5
Views
1K
  • Differential Equations
Replies
6
Views
3K
  • Differential Equations
Replies
1
Views
1K
  • Differential Equations
Replies
4
Views
6K
  • Differential Equations
Replies
6
Views
4K
  • Differential Equations
Replies
31
Views
6K
  • Programming and Computer Science
Replies
8
Views
2K
Replies
5
Views
1K
Back
Top