This code tests the accuracy of a given method against some examples found in the course textbook. In \(7.1\), we analyze \(u’ = -\sin(x); u_0 = 1; dt = 10^{-3}\). In \(7.2\), we change our driving function to \(u’ = \lambda (u - \cos(x)) - \sin(x)\) and require \(\lambda = -10\). And finally, for \(7.3\), we require \(\lambda = -2100\).
Input: A method for solving the examples
Output: The solutions given by the method
Usage/Example:
Output:
The error is still significant for \(7.1\) and \(7.2\), which is strange considering it is the same error experienced in Explicit Euler. I can’t find the source of this error yet, but it is easy to see that the error blows up for \(7.3\) where \(\lambda = -21000\), indicating that the predictor corrector method is also unstable in the same context Explicit Euler was.
It seems that, for a larger time step, Implicit Euler still beats out Predictor Corrector using an Adams-Bashforth method.
Implementation/Code:
All solver implementation for this assignment was covered in the last assignment.