#NEWLINE# def test_integrate( self ) : #NEWLINE# #INDENT# times = np . linspace ( 0 , 1 , 100 ) #NEWLINE# sys = System ( self . kane , times = times ) #NEWLINE# x_01 = sys . integrate ( ) #NEWLINE# sys = System ( self . kane , times = times ) #NEWLINE# sys . generate_ode_function ( generator = 'lambdify' ) #NEWLINE# x_02 = sys . integrate ( ) #NEWLINE# testing . assert_allclose ( x_01 , x_02 ) #NEWLINE# constants_dict = dict ( zip ( sm . symbols ( 'm0, k0, c0, g' ) , [ 1.0 , 1.0 , 1.0 , 1.0 ] ) ) #NEWLINE# specified_dict = { #NEWLINE# #INDENT# me . dynamicsymbols ( 'f0' ) : 0.0 , #NEWLINE# #UNINDENT# } #NEWLINE# x_03 = sys . ode_solver ( sys . evaluate_ode_function , [ 0 , 0 ] , sys . times , args = ( specified_dict , x_02 ) ) #NEWLINE# testing . assert_allclose ( x_02 , x_03 ) #NEWLINE# sys = System ( self . kane , times = times ) #NEWLINE# x0 = [ 5.1 , 3.7 ] #NEWLINE# ic = { #NEWLINE# #INDENT# me . dynamicsymbols ( 'x0' ) : x0 [ 0 ] , #NEWLINE# me . dynamicsymbols ( 'v0' ) : x0 [ 1 ] , #NEWLINE# #UNINDENT# } #NEWLINE# sys . initial_conditions = ic #NEWLINE# x_04 = sys . integrate ( ) #NEWLINE# x_05 = sys . ode_solver ( sys . evaluate_ode_function , x0 , sys . times , args = ( sys . _specifieds_padded_with_defaults ( ) , sys . _constants_padded_with_defaults ( ) ) ) #NEWLINE# testing . assert_allclose ( x_04 , x_05 ) #NEWLINE# if theano : #NEWLINE# #INDENT# sys . generate_ode_function ( generator = 'theano' ) #NEWLINE# sys . times = times #NEWLINE# x_06 = sys . integrate ( ) #NEWLINE# testing . assert_allclose ( x_04 , x_06 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# warnings . warn ( 'Theano was not found so the related tests are being skipped.' , PyDyImportWarning ) #NEWLINE# #UNINDENT# sys = System ( self . kane , times = times ) #NEWLINE# with testing . assert_raises ( NotImplementedError ) : #NEWLINE# #INDENT# sys . generate_ode_function ( generator = 'made-up' )