1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Question on Euler's method - Calculations using rounded numbers? HELP!

  1. Aug 12, 2013 #1
    1. The problem statement, all variables and given/known data

    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.

    2. Relevant equations


    3. 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! :)
  2. jcsd
  3. Aug 12, 2013 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper

    You are always using rounded values in this sort of calculation - proceed as normal.
    Record 5dp ... but calculate to all the dp you have.
  4. Aug 12, 2013 #3
    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)?
  5. Aug 12, 2013 #4

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper

    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted