This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from scipy.optimize import root | |
| from scipy.integrate import solve_ivp | |
| import matplotlib.pyplot as plt | |
| # Set up our approximation functions and a function to generate the system of equations we'll need | |
| def xtilde(t, a0_to_an): | |
| degree = len(a0_to_an) - 1 | |
| terms = [a0_to_an[i] * t**i for i in range(degree+1)] | |
| return sum(terms) |