Solving second-order ODE with Runge-Kutta 4

In summary, the conversation discusses the calculation of K1, K2, K3, and K4 in solving a differential equation, with the main question being how to calculate K2 when given an undefined value. The solution is to use the same values for yn and t as for K1, and then use K2 to calculate K3 and K4 before incrementing t and determining y(n+1).
  • #1
LANS
24
0

Homework Statement


0l0AByW.jpg

Note: I think there is a typo here but I'm not sure. Is there supposed to be a comma between the delta t/2 and y_n on K2 and K3, and delta t and y_n on K4?

Homework Equations


See above.

The Attempt at a Solution


Substituting dy/t = z gives
[itex]\frac{dz}{dt} = 3z - 2ty - cos(t)

\frac{dy}{dt} = z[/itex]

I'm not sure where to go from here. I can find K_1, but I'm not sure how to find K_2z as it depends on t, y, and z. What do I choose for z in K2? Do I need to redefine K_2 as

[itex] f \left ( t_n + \frac{\Delta t}{2}, y_n + \frac{K_1_y}{2}, z_n + \frac{k_1_z}{2} \right )[/itex] Is there some other way I should approach the problem?

Any help is appreciated, thanks.
 
Physics news on Phys.org
  • #2
In K1, there should be a comma between tn and yn.

In K2, K3, and K4, there should be commas between the delta t terms and the yn terms.

Remember z = dy/dt, and you are given dy/dt = 0 at t = 0.
 
  • #3
SteamKing said:
In K1, there should be a comma between tn and yn.

In K2, K3, and K4, there should be commas between the delta t terms and the yn terms.

Remember z = dy/dt, and you are given dy/dt = 0 at t = 0.

This is aimed towards SteamKing, K1 is found with dy/dt=0, but how is K2 solved when f(0.05,1) is undefined by the question and there is no obvious way to determine the f(0.05,1).

Thanks
 
  • #4
You are incrementing t between calculating K1 and K2, which is not what is called for in the definition of K1 ... K4. For K2, you use the same values for yn and t as for K1. Once you have calculated K2, you use this value to calculate K3, and you use K3 to calculate K4. Once you have calculated K1 ... K4, then you increment t by delta t and determine y(n+1).
 

Related to Solving second-order ODE with Runge-Kutta 4

What is a second-order ODE?

A second-order ordinary differential equation (ODE) is a mathematical equation that describes the relationship between a function and its derivatives of second order. It is commonly used in physics and engineering to model the behavior of systems over time.

What is Runge-Kutta 4?

Runge-Kutta 4 (RK4) is a numerical method for solving differential equations. It is a fourth-order method, meaning that it uses four intermediate steps to approximate the solution of a given ODE. It is one of the most widely used methods for solving second-order ODEs.

How does Runge-Kutta 4 work?

RK4 works by breaking down the original ODE into a series of smaller equations that can be solved using simple algebraic and arithmetic operations. It then uses these solutions to approximate the value of the original function at different points in time.

What are the advantages of using Runge-Kutta 4?

RK4 is a highly accurate and efficient method for solving second-order ODEs, making it a popular choice for scientists and engineers. It also has a relatively simple implementation and can handle a wide range of problems, making it a versatile tool for solving differential equations.

Are there any limitations to using Runge-Kutta 4?

While RK4 is a powerful method for solving second-order ODEs, it does have its limitations. For example, it may not be suitable for stiff systems or equations with highly oscillatory solutions. In these cases, other numerical methods may be more appropriate.

Similar threads

  • Calculus and Beyond Homework Help
Replies
14
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
Replies
4
Views
566
  • Calculus and Beyond Homework Help
Replies
5
Views
3K
  • Calculus and Beyond Homework Help
Replies
14
Views
3K
  • Programming and Computer Science
Replies
15
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
608
  • Calculus and Beyond Homework Help
Replies
6
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Differential Equations
Replies
6
Views
3K
Back
Top