The idea of this method is to find a paramterization of the equation so that for all input arguments the parameterization satisfies the equation.
# This line configures matplotlib to show figures embedded in the notebook,
# instead of opening a new window for each figure. More about that later.
# If you are using an old version of IPython, try using '%pylab inline' instead.
%matplotlib inline
## snakeviz is a very useful tool to visualizaion cprofile
%load_ext snakeviz
# numpy scipy and plot
import numpy as np
from scipy.optimize import minimize
from scipy.optimize import rosen, differential_evolution
import matplotlib.pyplot as plt
import scipy
from matplotlib.lines import Line2D
## To time the functions
import timeit
## The following is need for plotly
#import pandas as pd
#import plotly.plotly as py
#from plotly.graph_objs import *
#import plotly.tools as tls
The snakeviz extension is already loaded. To reload it, use: %reload_ext snakeviz
Solving first order differential equation
$$\frac{dy(t)}{dt}=-y(t)$$.
Here a parameterization like the fourier mode is used.
$$ y = \sum_m^{N} ( A_m \sin(mx) + B_m \cos(mx) ). $$The first order derivative is
$$ \frac{dy}{dt} = \sum_m^{N} ( A_m m \cos(mx) - B_m m \sin(mx) ) .$$The most important question after we have chosen a parameterization method is how many parameters is needed. We'll find out.
# Define the equation.