# Runge-Kutta 4th Order Integration help.Watch

#1
Hi,

I have been given two second order differential equations which I am to convert to a system of four first order differential equations:

I then get the following from these:
Attachment 794398794400

I now have to solve these using the runge-kutta first order method.
I am confused as to how to do this, because as far as I am aware, the format that this numerical method can be used on is the form of y'(t)=f(y,t).

my functions instead are such that for example equation 3 is s'(t)=f(z,t). (I have chosen my variable names poorly as that t is not time but just a letter.

my question is when solving the k values using this method, how can i calculate the f(y,t) values given that in my function i dont know how I can use the time value. are my initial system of first order equations wrong and i need to derive a different system or can it be solved ?

thanks
0
4 weeks ago
#2
(Original post by KloppOClock)
Hi,

I have been given two second order differential equations which I am to convert to a system of four first order differential equations:

I then get the following from these:

I now have to solve these using the runge-kutta first order method.
I am confused as to how to do this, because as far as I am aware, the format that this numerical method can be used on is the form of y'(t)=f(y,t).

my functions instead are such that for example equation 3 is s'(t)=f(z,t). (I have chosen my variable names poorly as that t is not time but just a letter.

my question is when solving the k values using this method, how can i calculate the f(y,t) values given that in my function i dont know how I can use the time value. are my initial system of first order equations wrong and i need to derive a different system or can it be solved ?

thanks
What does denote?? Is it differentiation with respect to ? If so, isn't it a bit confusing to then define ?
0
#3
(Original post by RDKGames)
What does denote?? Is it differentiation with respect to ? If so, isn't it a bit confusing to then define ?
yes thats what it means. i chose t as a variable by accident, should have called it something else. all the t's in the equations can be called something else but the differentials are differentiated with respect to time, not that t.
0
#4

i got functions 3-6 from 1-2. i then have to solve using kutta but they are not of the form y'=f(y,t) as you can see at the end.

can i still solve them using runge - kutta or are my differential equations wrong.
0
4 weeks ago
#5
(Original post by KloppOClock)

i got functions 3-6 from 1-2. i then have to solve using kutta but they are not of the form y'=f(y,t) as you can see at the end.

can i still solve them using runge - kutta or are my differential equations wrong.
Is your problem that "you don't know what t is", or that, for example, you have c' = f(c(t), b(t), z(t)) and you were expecting something more like c' = f(c(t))?
0
#6
(Original post by DFranklin)
Is your problem that "you don't know what t is", or that, for example, you have c' = f(c(t), b(t), z(t)) and you were expecting something more like c' = f(c(t))?
i was expecting to get c' as a function of c(t).

my problem is that i dont know if i can use my equations with this method because im not sure if ive derived the correct ones to use.

also when i work out the k values using this method i need to be able to evaluate c(t+dt) which i dont know how to do if i dont have any time variables in the actual equation or maybe im misunderstanding it
0
4 weeks ago
#7
(Original post by KloppOClock)
i was expecting to get c' as a function of c(t).

my problem is that i dont know if i can use my equations with this method because im not sure if ive derived the correct ones to use.

also when i work out the k values using this method i need to be able to evaluate c(t+dt) which i dont know how to do if i dont have any time variables in the actual equation or maybe im misunderstanding it
RK4 is an interative technique, so you iterate from one time to another to yield approximated values.

You don't 'solve' for or whatever it is.

The ODE's here are only dependent on through . It doesn't need to appear explicitly in the ODE's.
0
#8
(Original post by RDKGames)
RK4 is an interative technique, so you iterate from one time to another to yield approximated values.

You don't 'solve' for or whatever it is.

The ODE's here are only dependent on through . It doesn't need to appear explicitly in the ODE's.
https://en.wikipedia.org/wiki/Runge%...3Kutta_methods

i dont think i understand how to work out the values of k2,k3,k4.

how can i evaluate that function ?
0
4 weeks ago
#9
(Original post by KloppOClock)
i was expecting to get c' as a function of c(t).

my problem is that i dont know if i can use my equations with this method because im not sure if ive derived the correct ones to use.

also when i work out the k values using this method i need to be able to evaluate c(t+dt) which i dont know how to do if i dont have any time variables in the actual equation or maybe im misunderstanding it
if there's no t dependence, then f(c, t) = f(c). In other words, just pretend your function f takes a parameter t but doesn't do anything with it.
0
4 weeks ago
#10
(Original post by KloppOClock)
https://en.wikipedia.org/wiki/Runge%...3Kutta_methods

i dont think i understand how to work out the values of k2,k3,k4.

how can i evaluate that function ?
Are you happy you know how to find k1?
0
#11
(Original post by DFranklin)
Are you happy you know how to find k1?
what about my equations when its not c'(t) = c(t)

but like c'(t)= function of c(t),b(t),z(t)
0
4 weeks ago
#12
(Original post by KloppOClock)
what about my equations when its not c'(t) = c(t)

but like c'(t)= function of c(t),b(t),z(t)
The simplest way of looking at this is to think of y in the wiki article as being a vector. So here you'd have a vector

, and then y' = F(y), where the 4 components of F are basically the 4 equations (3)-(6) in your post #4. Then the equations in the wiki article still work and still apply (just ignoring t in F(y, t) etc. since our equations are time independent)

Or, on a stricly procedural basis:

if you have c' = f(c, b, z), and assuming you've already calculated and want to find then to find k1 you'd
just calculate h f(c_n, b_n, z_n). (f doesn't depend directly on t, so we just ignore it).

Now, to find k2, you need to have done this for *all* the components you need to evaluate f. That is, you found "k1 for c", but you need to find "k1 for b" and "k1 for z" as well. For clarity, denote these as .

Then k2 (for c, so if we wanted to be consistent about notation) is going to be

So you'd find all the k_2, then do something similar to find all the k_3, and then the k_4.

In terms of implementation, you *really* want to get comfortable with the idea of y being a vector, however.
0
#13
(Original post by DFranklin)
The simplest way of looking at this is to think of y in the wiki article as being a vector. So here you'd have a vector

, and then y' = F(y), where the 4 components of F are basically the 4 equations (3)-(6) in your post #4. Then the equations in the wiki article still work and still apply (just ignoring t in F(y, t) etc. since our equations are time independent)

Or, on a stricly procedural basis:

if you have c' = f(c, b, z), and assuming you've already calculated and want to find then to find k1 you'd
just calculate h f(c_n, b_n, z_n). (f doesn't depend directly on t, so we just ignore it).

Now, to find k2, you need to have done this for *all* the components you need to evaluate f. That is, you found "k1 for c", but you need to find "k1 for b" and "k1 for z" as well. For clarity, denote these as .

Then k2 (for c, so if we wanted to be consistent about notation) is going to be

So you'd find all the k_2, then do something similar to find all the k_3, and then the k_4.

In terms of implementation, you *really* want to get comfortable with the idea of y being a vector, however.
this has cleared it up for me so much, thank you xx
0
X

new posts
Latest
My Feed

### Oops, nobody has postedin the last few hours.

Why not re-start the conversation?

see more

### See more of what you like onThe Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

### University open days

• University of Bath
Sat, 23 Feb '19
• Ravensbourne University London
School of Design, School of Media Further education
Sat, 23 Feb '19
• Leeds Trinity University
PGCE Open Day Further education
Sat, 23 Feb '19

### Poll

Join the discussion

#### Do you have a food intolerance or allergy?

Yes - a food intolerance (45)
12.33%
Yes - a food allergy (39)
10.68%
Yes - an autoimmune disorder (i.e coeliac, colitis) (11)
3.01%
Yes - I have an intolerance and allergy (9)
2.47%
No (261)
71.51%