-
-
Save springcoil/dacc5dcadc11d4165473 to your computer and use it in GitHub Desktop.
Simple Gist of an ODE
This file contains 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 | |
A1 = bs * ( astr * N ) ** 2 | |
A2 = c1 / tdS | |
A3 = ( 1 - bs ) * ( astr * N ) ** 2 | |
A4 = A1 * z0 | |
A5 = A3 * z0 | |
A6 = C | |
A7 = 0.5 * ( ( c2 / tt ) + ( c1 / tdS ) ) | |
A8 = ( c2 / tt ) - ( c1 / tdS ) | |
def dX_dt(X, t=0): | |
""" Return the triple ODE calculations """ | |
return array([ - A1 * X[2] + A4, | |
- A2 * X[1] + A3 * X[2] - A5, | |
X[0] - X[1] ]) | |
from scipy import integrate | |
t = linspace(0, 35, 1000) # time | |
X0 = array([0, 1, 0]) # initials conditions | |
X, infodict = integrate.odeint(dX_dt, X0, t, full_output=True) | |
infodict['message'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment