This example by Aron Ahmadia and David Ketcheson is licensed under a Creative Commons Attribution 4.0 International License. All code examples are also licensed under the MIT license.
from IPython.core.display import HTML
css_file = './example.css'
HTML(open(css_file, "r").read())
Together with your teammate, write a Python script or function to do the following:
for $i=2,3,\dots,m$, where $h$ is the spacing between successive points.
Try running your function with different values of $m$ and check that its output tends to the exact second derivative as $m$ is increased.
There are at least 3 different ways to program step 3:
Can you code all 3? Which is the fastest? You can time any line of code in IPython using %timeit.
Now add the following to your function:
Compute the three error norms for each $m$-value.