 ## ← 07-11 Roundoff Error

• 1 Follower
• 52 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=dT-QRGc8nTc" data-team="udacity"></div> ``` 1 Language

• English [en]

Showing Revision 1 created 10/24/2012 by Amara Bot.

1. Up to now we have only dealt with the effect of a finite time step,
2. but actually also the representation of the values on the x axis is cross-grained.
3. Now we have a look at what this leads to,
4. and for simplicity it's again the forward Euler method.
5. As a test case, we're using that satellite that's almost geostationary from Unit 2.
6. It takes precisely 24 hours to complete one orbit around the earth.
7. What's critical about the forward Euler method in terms of round-off error
8. is this addition and this one.
9. X(t) is a number of reasonable size.
10. In this case quite an amount of meters.
11. I'm just drawing some ghost figures here to give an impression,
12. but the step size times the velocity is pretty small in comparison,
13. because we're multiplying by that small step size.
14. If the velocity is of reasonable size and we multiply by that small step size,
15. we get a number that's rather small in comparison to x.
16. Then we form the sum of these two numbers and get something that looks like this,
17. but actually this number again is computed and is being stored
18. at the position of x--the loose position in that process.
19. Actually, you see the value of x didn't have enough position to start with.
20. The smaller we choose the step size, the smaller this number becomes,
21. the more grave the effect of round-off error will be.
22. The effect of the round off error is that we actually are losing the details of velocity and force.
23. We could have gotten away with not computing these digits anyway.
24. To see a noticeable effect of round-off errors in a manageable time, I'm cheating a little here.
25. I'm using standard Euler, but them I'm multiplying by a number of 1 plus tiny random number.
26. This epsilon is defined to be 2 * 10⁻⁶ in advance.
27. This looks as though I have a pretty huge round-off error every time.
28. This is the result that we get.
29. First I have to explain why we see several points for each step size.
30. This is because we're dealing with random numbers
31. and because I let the computer try out every step size 10 times.
32. The overall behavior is what we know.
33. With the forward Euler method the error depends linearly on the step size,
34. at least for step sizes that are small enough.
35. But for very small step sizes you see--uh-oh--the error explodes,
36. and we have many small steps.
37. Round-off error accumulates and destroys our result.
38. What you should be learning from this reducing the step size
39. only takes you so far.
40. There is a threshold after which the error goes up again
41. and may become severe.
42. Let's look at the same data from a different viewpoint.
43. Let's note that the error depends on the step size,
44. but let's plot how the error depends on the number of steps.
45. This is what we get.
46. For a small number of steps, the step size is large,
47. and the forward Euler method introduces a huge error,
48. which then decreases in a linear fashion,
49. but as the number of steps grows, we get more and more error due to round off.
50. The simple model for this behavior would be to say that the error introduced by rounding
51. is proportional to the number of steps
52. and hence inversely proportional to the step size plus h.