## module bulStoer ''' X,Y = bulStoer(F,x,y,xStop,H,tol=1.0e-6). Simplified Bulirsch-Stoer method for solving the initial value problem {y}' = {F(x,{y})}, where {y} = {y[0],y[1],...y[n-1]}. x,y = initial conditions xStop = terminal value of x H = increment of x at which results are stored F = user-supplied function that returns the array F(x,y) = {y'[0],y'[1],...,y'[n-1]}. ''' from numarray import array from midpoint import * def bulStoer(F,x,y,xStop,H,tol=1.0e-6): X = [] Y = [] X.append(x) Y.append(y) while x < xStop: H = min(H,xStop - x) y = integrate(F,x,y,x + H,tol) # Midpoint method x = x + H X.append(x) Y.append(y) return array(X),array(Y)