#! /usr/bin/env python3 # def expm_ode ( x, y ): """ expm_ode ( x, y ) evaluates the ODE right hand side dy/dx=-y+3*x Input: x is the independent variable y is the dependent variable Output: dydx is the value of dy/dx """ dydx = - y - 3.0 * x return dydx def expm_ode_test ( ): import numpy as np print ( "expm_ode_test:" ) x = np.random.rand ( ) y = np.random.rand ( ) dydx = expm_ode ( x, y ) print ( "x = ", x, "y = ", y, "dydx = ", dydx ) return if ( __name__ == "__main__" ): expm_ode_test ( )