Spring 2018


Jim says

Very nice.


Where is this going - are you going to continue with Runge-Kutta?

I would point out that the large errors in your first analysis are from my point of view not only because of the truncation error but also because you are using a ridiculously large step of h=0.1. This is not small.

If you set for example h=0.0001 then the error becomes too small to see on plot.

The whole point of these approaches on modern computing systems is that it is relatively fast easy to do a large number of steps. And the first and simplest approach to checking your accuracy is to make the step size smaller to see if your result changes. Comparing h=0.01 to h=0.1 gives different answers; therefore, h=0.1 is not appropriate.

Part of the game here is to decide how much error is acceptable, which will inform how small the step can be.

Fancier numeric techniques - like Runge-Kutta - will give better accuracy for a given step size, at a cost of more analysis and (probably) more intermediate calculations. But they won't change these underlying ideas:

Minor gripe: should be "plt.show()", not "plt.show".

Not quite so minor gripe: your plot of (h vs error) doesn't to my eyes show clearly what you say that it shows. Check out my modified version.

Some of the LaTeX didn't display correctly in your .html file. I don't think it's your LaTeX, since it did display fine in the "jupyter nbconvert" that I did.

attachments [paper clip]

  last modified size
TXT eulers_method.html Mon Jun 24 2024 12:24 am 491K
TXT eulers_method.ipynb Mon Jun 24 2024 12:24 am 222K
TXT eulers_method_jim.html Mon Jun 24 2024 12:24 am 481K
TXT eulers_method_jim.ipynb Mon Jun 24 2024 12:24 am 211K