I am attempting to use Euler's method to express the following system of ODE's...
Dania Mueller
Answered question
2022-06-14
I am attempting to use Euler's method to express the following system of ODE's...
using the discretised equations, which are presented below in matrix notation:
Note when , 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
Beginner2022-06-15Added 21 answers
Assuming for , and, say, we have two equations:
Write it in vector form:
So,
Given the initial conditions , and a time step you can use the Euler Method as:
You don't need to use matrices on this system of equations.
Edit: If you have an equation that is linear in and , you can define two vectors and , so your function is of the form:
And the time integration scheme will be (admitting constant and ):
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 , so will be a diagonal matrix instead.
George Bray
Beginner2022-06-16Added 12 answers
Since the th equation only depends on the th 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 as "considering the initial condition". The initial conditions and are two separate unrelated things.