Differential Equation Solving System: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
import math | import math | ||
import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
# Initial conditions | \# Initial conditions | ||
y0 = 2.0 | y0 = 2.0 | ||
# Time step and final time | \# Time step and final time | ||
dt = 1.0 # days | dt = 1.0 # days | ||
tf = 364 .0 # days | tf = 364 .0 # days | ||
# Empty lists to hold the time and solution | \# Empty lists to hold the time and solution | ||
tt = [ ] | tt = [ ] | ||
yy = [ ] | yy = [ ] | ||
# Append initial values | \# Append initial values | ||
tt.append (0.0) | tt.append (0.0) | ||
yy . append (y0) | yy . append (y0) | ||
# Parameters of our equation | \# Parameters of our equation | ||
a = 0.01 | a = 0.01 | ||
omega = 2.0*math.pi/365.0 | omega = 2.0*math.pi/365.0 | ||
# Iteration | \# Iteration | ||
while tt [−1] <= tf : | while tt [−1] <= tf : | ||
r = a*yy[−1]*(1+math . sin(omega*tt[ − 1 ])) | r = a*yy[−1]*(1+math . sin(omega*tt[ − 1 ])) |
Revision as of 12:19, 15 January 2016
A Differential Equation Solving System is an equation solving system that can apply a differential equation solving algorithm to solve a differential equation solving task.
- AKA: Differential Equation Solver.
- Example(s):
import math import matplotlib.pyplot as plt \# Initial conditions y0 = 2.0 \# Time step and final time dt = 1.0 # days tf = 364 .0 # days \# Empty lists to hold the time and solution tt = [ ] yy = [ ] \# Append initial values tt.append (0.0) yy . append (y0) \# Parameters of our equation a = 0.01 omega = 2.0*math.pi/365.0 \# Iteration while tt [−1] <= tf : r = a*yy[−1]*(1+math . sin(omega*tt[ − 1 ])) yy.append(yy[−1]+ r*dt) tt.append (tt[−1]+dt) plt.figure(1) plt.plot(tt,yy,'.') plt.xlabel('Time[days]') plt.ylabel('Rats[rats]') plt.title('Euler Solution') plt.show( )
- Runge-Kutta Method System, that applies a Runge-Kutta algorithm.
- Predictor-Corrector Method System.
- Adams-Bashforth Method System, that applies an Adams-Bashforth algorithm..
- Adam-Moulton Method System, that applies an Adam-Moulton algorithm..
- Milne-Simpson Method System, that applies a Milne-Simpson algorithm..
- a PDE System.
- an ODE System.
- See: Differential Equation.