Question on Euler's method - Calculations using rounded numbers? HELP

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
joshuad
Messages
5
Reaction score
0

Homework Statement



Taking step size h = 0.2, use Euler’s Method to determine y(1.6), given that
dy/dx = ln(2y+x) ; y(1)=1.2
Record your results to 5 decimal places at each step.

Homework Equations



N/A

The Attempt at a Solution



My question is to do with the method, not the solution, specifically the 'Record your results to 5 decimal places at each step' part. I know that basically you need to use 2 iterations to get an approximation for y(1.6). In the calculations themselves do I use the full values displayed on my calculator, or do I use the value rounded to 5 decimal places?

For example:

y'(1,1.2) = 1.22377543162

then to get y(1.2) we use y[n+1] = y[n] + hy'[n]

so y(1.2) = 1.2 + 0.2( y'[n] )

My question is at this point, do I use 1.22377543162 -or- do I use 1.22378 for y'[n] to calculate y(1.2)?

Please Help! :)
 
Physics news on Phys.org
So I would write down (in this case) y'[n]=1.22378 in my table, but actually use 1.22377543162 in the calculation to work out y(1.2)?
 
That's right - you are over thinking this ... imagine your calculator gave you 1000 digits each time, would you want to write them all down?
I use GNU Octave - it does its calculations to 8dp, but only actually reports 4dp.
At each stage it stores the whole precision numbers and uses the whole precision in calculations.

Write down 5dp, but use all the dp in the next iteration.
Otherwise you'll accumulate rounding errors.

If you are still nervous, do it both ways and see what difference it makes.
 
  • Like
Likes   Reactions: 1 person