- #1
Cypeq
- 5
- 0
Hello,
i have a bit of a problem with uderestanding how exactly we use RK4 method for solving 2nd order ODE.
And last conversation with my proffesor only added up to my confiusion.
Further more i couldn't find any example dealing with this problem if any1 could provide link explaining
this problem along with solving example that would be very helpfull.
so let's consider very basic 2nd order ODE
[tex]
x''(t) = Ax'(t) + Bx(t) + C
[/tex]
i know that step i need to take is to make some assignments
[tex]x(t) = x_1[/tex]
[tex]x'(t) = x_2[/tex]
which allows me to deal with two 1st order ODE
[tex]x'(t) = x_2[/tex]
[tex]x''(t) = A x_2 + B x_1 + C[/tex]
but I'm confused how exact runge kutta steps will look like
that's my idea totaly not shure if correct:
[tex]k_1 = x_{2,n}[/tex]
[tex]l_1 = f(t, x_{1,n}, x_{2,n}) = A x_{2,n} + B x_{1,n} + C[/tex]
[tex]k_2 =x_{2,n} + \frac 1 2 l_1[/tex]
[tex]l_2 = f(t + \frac 1 2 h, x_{1,n} + \frac 1 2 k_1, x_{2,n} + \frac 1 2 l_1)[/tex]
[tex]k_3 =x_{2,n} + \frac 1 2 l_2[/tex]
[tex]l_3 = f(t + \frac 1 2 h, x_{1,n} + \frac 1 2 k_2, x_{2,n} + \frac 1 2 l_2)[/tex]
[tex]k_4 =x_{2,n} + l_3[/tex]
[tex]l_4 = f(t + h, x_{1,n} + k_3, x_{2,n} + l_3)[/tex]
[tex]x_{1,n+1} = x_{1,n} + \frac 1 6 h(k_1 + 2k_2 + 2k_3 + k_4)[/tex]
[tex]x_{2,n+1} = x_{2,n} + \frac 1 6 h(l_1 + 2l_2 + 2l_3 + l_4)[/tex]
I'm preticiulary interested how numerical integration looks like for first element x'(t) = x_2
Proffesors idea was that it should be in all K_1 = , K_2 = ... there should be L_ instead of K_
[tex]k_2 =x_{2,n} + \frac 1 2 k_1[/tex]
and so on... ending with
[tex]k_4 =x_{2,n} + k_3[/tex]
[tex]l_4 = f(t + h, x_{1,n} + k_3, x_{2,n} + l_3)[/tex]
Please help me and correct possible errors... Help me Physics Forum you are my only hope ;-)
edit: since few hours passed with above 70 views
some1 knowing the solution but maybe not having a time write it down just say if it's good or bad please.
i have a bit of a problem with uderestanding how exactly we use RK4 method for solving 2nd order ODE.
And last conversation with my proffesor only added up to my confiusion.
Further more i couldn't find any example dealing with this problem if any1 could provide link explaining
this problem along with solving example that would be very helpfull.
so let's consider very basic 2nd order ODE
[tex]
x''(t) = Ax'(t) + Bx(t) + C
[/tex]
i know that step i need to take is to make some assignments
[tex]x(t) = x_1[/tex]
[tex]x'(t) = x_2[/tex]
which allows me to deal with two 1st order ODE
[tex]x'(t) = x_2[/tex]
[tex]x''(t) = A x_2 + B x_1 + C[/tex]
but I'm confused how exact runge kutta steps will look like
that's my idea totaly not shure if correct:
[tex]k_1 = x_{2,n}[/tex]
[tex]l_1 = f(t, x_{1,n}, x_{2,n}) = A x_{2,n} + B x_{1,n} + C[/tex]
[tex]k_2 =x_{2,n} + \frac 1 2 l_1[/tex]
[tex]l_2 = f(t + \frac 1 2 h, x_{1,n} + \frac 1 2 k_1, x_{2,n} + \frac 1 2 l_1)[/tex]
[tex]k_3 =x_{2,n} + \frac 1 2 l_2[/tex]
[tex]l_3 = f(t + \frac 1 2 h, x_{1,n} + \frac 1 2 k_2, x_{2,n} + \frac 1 2 l_2)[/tex]
[tex]k_4 =x_{2,n} + l_3[/tex]
[tex]l_4 = f(t + h, x_{1,n} + k_3, x_{2,n} + l_3)[/tex]
[tex]x_{1,n+1} = x_{1,n} + \frac 1 6 h(k_1 + 2k_2 + 2k_3 + k_4)[/tex]
[tex]x_{2,n+1} = x_{2,n} + \frac 1 6 h(l_1 + 2l_2 + 2l_3 + l_4)[/tex]
I'm preticiulary interested how numerical integration looks like for first element x'(t) = x_2
Proffesors idea was that it should be in all K_1 = , K_2 = ... there should be L_ instead of K_
[tex]k_2 =x_{2,n} + \frac 1 2 k_1[/tex]
and so on... ending with
[tex]k_4 =x_{2,n} + k_3[/tex]
[tex]l_4 = f(t + h, x_{1,n} + k_3, x_{2,n} + l_3)[/tex]
Please help me and correct possible errors... Help me Physics Forum you are my only hope ;-)
edit: since few hours passed with above 70 views
some1 knowing the solution but maybe not having a time write it down just say if it's good or bad please.
Last edited: