I have a question from my book and it says essentially, consider the IVP x^dot=−x with x(0)=1, what is the exact value of x(1), then using Eulers method with step size1 , estimate x(1) call this x^*(1) , then repeat for step sizes of 10^(−n) for n=1,2,3,4 then finally plot E=|x^*(1)−x(1)| as a function of step size and then as lnE vs lnt. Now I am having some issues and ill explain, for the first part I get that x(1)=e^(−1)

Braeden Valenzuela

Braeden Valenzuela

Open question

2022-08-22

I have a question from my book and it says essentially, consider the IVP x = x with x ( 0 ) = 1, what is the exact value of x ( 1 ), then using Eulers method with step size1 , estimate x ( 1 ) call this x ( 1 ) , then repeat for step sizes of 10 n for n = 1 , 2 , 3 , 4 then finally plot E = | x ( 1 ) x ( 1 ) | as a function of step size and then as l n E vs l n t.
Now I am having some issues and ill explain,
for the first part I get that x ( 1 ) = e 1
We have f ( x ) = x and x 0 = 1
so I have that by Euler method
x 1 = x 0 + f ( x 0 ) t
which would imply that for t = 1 , x 1 = 0
and then for the second part it would imply x 1 = 0.9, then 0.99, then 0.999 and finally 0.9999.
But this doesn't seem to make any sense to me. Seeing as none of these are close to e 1
So I am confused in regard to where I am making mistakes, or where everything is going wrong. For the plotting part, I am also stuck because of this. I am looking for any help and advice.

Answer & Explanation

Rayan Ali

Rayan Ali

Beginner2022-08-23Added 8 answers

Let h = 1 / m be the step size, Euler's methode applied to the discretization ( t k ) 0 k n with t k = k / m yields the values x 0 , , x m . With x 0 = 1 and
x k + 1 = x k h x k = ( 1 h ) x k , k = 0 , , m 1
This implies, by an easy induction, that
x k = ( 1 h ) k , k = 0 , , m
Now the estimate of x ( 1 ) = e 1 given by Euler's corresponding to step size h = 1 / m is x ( 1 ) = x m = ( 1 h ) m = ( 1 1 m ) m , and the corresponding error is
E = E ( m ) = | e 1 ( 1 1 m ) m | = e 1 ( 1 1 m ) m
In particular,
E ( m ) = e 1 2 m + O ( 1 m 2 )
Or equivalently, in terms of the step size h:
E ( h ) = e 1 2 h + O ( h 2 )
So the plot ( log h , log E ) should be very close to the line y = x log 2 1.

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?