# This is a test script for the Euler solver written in C # To use it, simply do # >> import test # >> test.run() # defining the derivative functions: def f1(x,t): return x[0]*x[1] def f2(x,t): return -x[0]*t L = [f1,f2] # this is the array of derivatives (represents the ODE) # setting the initial conditions: x = [1,2] t = 1.0 dt = 5.0 # importing the extension module: import Euler # we need Euler.so or Euler.pyd in the path... # the testing routine: def run(): newx = Euler.step(L,x,t,dt) # testing Euler extension! print "Euler.step(f,x,t,dt) with f = [x[0]*x[1], -x[0]*t], x =", x, "t =", t, "and dt =", dt print "yields newx = ", newx print "This should be [11.0, -3.0] if everything works."