Skip to content

Instantly share code, notes, and snippets.

@springcoil
Created April 15, 2015 18:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save springcoil/dacc5dcadc11d4165473 to your computer and use it in GitHub Desktop.
Save springcoil/dacc5dcadc11d4165473 to your computer and use it in GitHub Desktop.
Simple Gist of an ODE
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