using Dates using ODE using PyPlot function f( t, y ) # # The van der Pol equation: # # y'' - mu * ( 1 - y^2 ) * y' + y = 0 # mu = 2.5 ydot = similar( y ) ydot[1] = y[2] ydot[2] = mu * ( 1.0 - y[1] * y[1] ) * y[2] - y[1] ydot end println( now( ) ) println( "ODE.ode23s_test():" ) println( " Julia version" ) println( " Test ODE.ode23s() on van der Pol equation." ) # # Solve it from t=0 to t=12, using steps of size 0.1. # t = [ 0.0:0.1:12.0;] # # The initial condition, y = -0.3, y' = -0.2 # y0 = [ -0.3, -0.2 ] # # Call the ode23s solver. # t, y = ODE.ode23s( f, y0, t ) # # Rearrange the output to make the plot() command nicer. # y1 = [ a[1] for a in y ] y2 = [ a[2] for a in y ] plot( float( y1 ), float( y2 ) ) # # Save the plot in a PNG file. # filename = "ODE.ode23s_test.png" savefig( filename ) println( "" ) println( " Graphics saved as '" * filename * "'" ) # # Terminate. # println( "" ) println( "ODE.ode23s_test():" ) println( " Normal end of execution." ) println( now( ) )