I am attempting to use Euler's method to express the following system of ODE's...

Dania Mueller

Dania Mueller

Answered question

2022-06-14

I am attempting to use Euler's method to express the following system of ODE's...
d y i d x = c i ( y i 1 3 y i 3 ) + f i ( for  i = 1 , , n )
using the discretised equations, which are presented below in matrix notation:
y ( t k + 1 ) = C 1 y ( t k ) + C 2 y 3 ( t k ) + f
Note f i = 1 when i = 1, but otherwise equals 0 (this considers the initial condition). Whilst I am familiar with Euler's method, I am unsure of the steps to get to the first equation to the second. Can anyone assist me with this? Understanding this is necessary for a project I'm working on, so I would really appreciate any help.

Answer & Explanation

trajeronls

trajeronls

Beginner2022-06-15Added 21 answers

Assuming y 0 = 0 for i = 0, and, say, we have two equations:
d y 1 d t = c 1 y 1 3 + f 1 d y 2 d t = c 2 ( y 1 3 y 2 3 ) + f 2
Write it in vector form:
y ˙ = F ( t , y )
So,
y ˙ = F ( t , y ) = { c 1 y 1 3 + f 1 ( t ) c 2 ( y 1 3 y 2 3 ) + f 2 ( t ) }
Given the initial conditions y 1 ( 0 ) = y 10 , y 2 ( 0 ) = y 20 , and a time step h you can use the Euler Method as:
y ( k + 1 ) = y ( k ) + h F ( t ( k ) , y ( k ) )
You don't need to use matrices on this system of equations.

Edit:
If you have an equation that is linear in y and y 3 , you can define two vectors c 1 and c 2 , so your function is of the form:
y ˙ = c 1 y + c 2 y 3
And the time integration scheme will be (admitting constant c 1 and c 2 ):
y ( k + 1 ) = y ( k ) + h ( c 1 y ( k ) + c 2 y 3 ( k ) )
Observe that the ⋅ operator is an element-wise operator. If you don't have implemented en element-wise operator, you can also use matrix multiplication and define c = d i a g ( c ), so c will be a diagonal matrix instead.
George Bray

George Bray

Beginner2022-06-16Added 12 answers

Since the ith equation only depends on the i 1th equation which is already solved, the equation can be solved sequentially without needing a matrix formulation. Also, I'm not clear as to what you mean by f i = δ i 1 as "considering the initial condition". The initial conditions y i = y i ( 0 ) and f i are two separate unrelated things.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?