Import modules :
Initial condition :
Time stepping options :
Part 1 : Solving the problem
Implement and solve the problem using your own functions for the backward Euler's method and Newton's method.
/tmp/ipykernel_160/2476182983.py:1: MatplotlibDeprecationWarning: The seaborn styles shipped by Matplotlib are deprecated since 3.6, as they no longer correspond to the styles shipped by seaborn. However, they will remain available as 'seaborn-v0_8-<style>'. Alternatively, directly use the seaborn API instead. plt.style.use('seaborn-poster')
Part 2 : Convergence Assessment
Compute successive numerical solutions as you increase the number of time steps
You can use 1D piecewise linear interpolation directly from SciPy:
Compute and plot (in double logarithmic scale) the rmse(m) by increasing m until you consider that your solution is accurate enough.
Solve the same problem using SciPy's function from the submodule
Use the integration method . Check what the method does and how to use it.
The methods does not require a time stepping vector. Instead the user sets the absolute tolerance through the keyword argument , and the time step size is adapted automatically to guarantee the user-specified accuracy requirements. Compare the number of time steps that are needed by LSODA and your Backward Euler Method to achieve comparable accuracy.