y′′+pi ye^(x/3)(2y′sin(pi x)+pi ycos(pi x))=y/9 for the initial conditions y(0)=1, y′(0)=−1/3 solve the equation below with Euler's method

Lilliana Livingston

Lilliana Livingston

Answered question

2022-07-16

I need to solve the equation below with Euler's method:
y + π y e x / 3 ( 2 y sin ( π x ) + π y cos ( π x ) ) = y 9
for the initial conditions y ( 0 ) = 1, y ( 0 ) = 1 / 3
So I know I need to turn the problem into a system of two first order differential equations.
Therefore u 1 = y and u 2 = y I can now write the system as:
u 1 = y u 2 = y 9 π y e x / 3 ( 2 u 1 sin ( π x ) π y cos ( π x ) )
How do I proceed from here?

Answer & Explanation

Tristan Pittman

Tristan Pittman

Beginner2022-07-17Added 14 answers

Letting u = y is the right idea. This gives you the pair of equations
u = y 9 π y e x / 3 ( 2 u sin ( π x ) + π y cos ( π x ) ) y = u
which is a standard initial value problem. Notice that there are no x derivatives, so you can integrate each value of x separately. So fix some value for x and discretize the system using your favorite method -- I am a big fan of Velocity Verlet:
y n + 1 = y n + h u n u n + 1 = u n + h ( y n + 1 9 π y n + 1 e x / 3 ( 2 u n sin ( π x ) + π y n + 1 cos ( π x ) ) ) ,
where h is the time step; you could also use e.g. forward or backward Euler (you say you want "Euler's method" but there are at least three!). You know u 0 and v 0 from the initial conditions, so just iteratively apply the above rules to trace out the trajectory through time.
EDIT: Forward Euler would be
u n + 1 = u n + h ( y n 9 π y n e x / 3 ( 2 u n sin ( π x ) + π y n cos ( π x ) ) ) , y n + 1 = y n + h u n + 1
Notice that I strongly recommend against using Explicit Euler in pretty much any circumstance.

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?