Let's say I have solved an ODE with Euler's forward method, and also solved it using RK4, in both cases for varying decreasing step sizes h. Is there any way to look at the graphs and "see" the order of accuracy of the methods?

Chaim Ferguson 2022-10-23 Answered
Let's say I have solved an ODE with Euler's forward method, and also solved it using RK4, in both cases for varying decreasing step sizes h. Is there any way to look at the graphs and "see" the order of accuracy of the methods?
You can still ask an expert for help

Expert Community at Your Service

  • Live experts 24/7
  • Questions are typically answered in as fast as 30 minutes
  • Personalized clear answers
Learn more

Solve your problem for the price of one coffee

  • Available 24/7
  • Math expert for every subject
  • Pay only if we can solve it
Ask Question

Answers (1)

Adalyn Pitts
Answered 2022-10-24 Author has 15 answers
Yes, graph the differences of the results for stepsizes h and 2 hh as double-logarithmic plot. The graph should be of lines, and the slopes correspond to the order of the method.

More precisely, the numerical result for step size h is in first order of approximation
y h = y + C · h p + D / h
where C accumulates the derivative factors for the method error and D accounts for the floating point errors in the evaluation of every single step.
Thus the mentioned difference gives
y 2 h y h = ( 2 p 1 ) · C · h p D / ( 2 h )
so that for moderately small h D / C p + 1 one gets
log ( y 2 h y h ) log ( ( 2 p 1 ) · C ) + p · log ( h )
Did you like this example?
Subscribe for all access

Expert Community at Your Service

  • Live experts 24/7
  • Questions are typically answered in as fast as 30 minutes
  • Personalized clear answers
Learn more

You might be interested in

asked 2022-07-23
In particular, if Euler's method is implemented on a computer, what's the minimum step size that can be used before rounding errors cause the Euler approximations to become completely unreliable?
I presume it's when step size reaches the machine epsilon? E.g. if machine epsilon is e-16, then once step size is roughly e-16, the Euler approximations are unreliable.
asked 2022-09-19
I am trying to show that, for the equation
y + α y = 0
alternating between a forward Euler method step for y 2 n and a backward Euler step for y 2 n + 1 with time-step h is equivalent to
y n + 1 = 1 α h 1 + α h y n
I have that
y 1 = y 0 + h ( α y 0 ) = ( 1 α h ) y 0
How exactly ( 1 + α h ) works into this I don't see. If I just press forward anyway, using the trapezoid rule for the backward Euler step next, and call y ^ n the approximation of y n using the forward Euler method, I get
y 2 = y 1 + h ( y 1 + y ^ 2 2 )
I'm kind of doing this a priori but that seems right to me: the trapezoid rule is to multiply the change in the x-axis by the average of the bases which are y 1 and y 2 . This becomes
y 2 = y 1 + h ( y 1 + ( 1 α h ) y 1 2 ) = ( 1 + h ( 2 α h 2 ) ) y 1
This doesn't seem to be shaping up to the form I'm supposed to be getting. Am I doing something wrong?
asked 2022-07-15
This question was asked in CSIR. please help me to find out correct choice

Let y ( t ) satisfy the differential equation
y = λ y ; y ( 0 ) = 1
. Then the backward Euler method for n > 1 and h > 0
y n y n 1 h = λ y n ; y ( 0 ) = 1
yields
1. a first order approximation to e λ n h
2. a polynomial approximation to e λ n h
3. a rational function approximation to e λ n h
4. a Chebyshev polynomial approximation to e λ n h
asked 2022-11-04
e 3 t c o s ( 2 3 t ) d t
I have been asked to evaluate that using complex exponential/euler's method. I have done many similar questions but all of them had something like (cos3x), sin(5t) etc. This is the first time I have come across a question where its of the format (cos a+bx) and cannot understand how to deal with the extra term. I have been stuck for a while now and have thus decided to ask the community for help, please help me out.
asked 2022-05-09
We have been told that u ( t ) = u ( t ) and u ( 0 ) = 1 from this information we can conclude that u ( t ) = e x
Show that u k = ( 1 + h ) k , k = 0 , 1 , . . . is an approximation for u ( k h ) using Euler's method
My current thoughts are that h is the interval by which we increment, but I am not sure where to go from there.
asked 2022-06-21
How do you work out if Euler's method overestimates the actual solution, for the ODE:
d y d x = 24 tan ( π x )
With steps of 0.25 from 1 x 2?
asked 2022-10-15
Consider the ODE
f ( u ) u = a u + b , u ( t 0 = 0 ) u 0 = u 0
For a timestep k, the forward-difference approximator for u gives the Euler update as
u n + 1 = u n + k f ( u n ) = u n + k ( a u n + b )
I am trying to come up with a closed form expression for u n , that is, one that involves only the constants a , b , u 0 , k.
I've tried to do this by first writing u n as a cumulative sum
u n = u n + k ( a u n + b ) = u 0 + i = 0 n 1 k ( a u i + b )
I then tried to expand the sum on the right and see if there was any easily identifiable pattern to write more generally, or if it would perhaps resemble an expansion of some other known function.After some ugly algebra, this is something like
u n = u 0 + k ( a u 0 + b ) + k ( a u 1 + b ) + k ( a u 2 + b ) + . . . = u 0 + k ( a u 0 + b ) + ( k 2 a + k ) ( a u 0 + b ) + ( k 3 a 2 + 2 k 2 a + k ) ( a u 0 + b ) + . . . = u 0 + ( k 3 a 2 + 3 k 2 a + 3 k + . . . ) ( a u 0 + b )
Nothing jumps out to me, and I'm not sure this approach is promising. Any ideas?
I've massaged it some more and found that it can be written as
u n = ( 1 + k a ) n u 0 + C n
Where C is a function of a,b,k,n, which I've yet to deduce...