MTH3007B Weekly Problems 3
Vibes: Super chill, just implement a single new method.
Used Techniques:
- Finding the order of a numerical method
- Solving an ODE with the implicit trapezoid method
1.1. Order of an Euler Method
Question
What is the order of the implicit Euler method? (i.e., the global truncation error)
First-order, by definition.
1.2. Order of a Non-Symmetrical Method
Question
What is the order of the implicit trapezoid method? (i.e., the global truncation error)
Second-order, by definition.
1.3. Solving an ODE with the Implicit Trapezoid Method
Question
Solve the ordinary differential equation using the implicit trapezoid method up to , given that .
Then, find for the .
First, do our imports…
import micropip
await micropip.install("numpy")
from collections.abc import Callable
import numpy as np
import numpy.typing as nptThen we can implement a new implicit trapezoid method function…
Python
Output
Which can then be run with the correct parameters…
Python
Output
Given the final solution, Solution at t = 1.0: z(1.0) = 2.034534.