## This script file uses the function planet10 after getting the user to choose the initial condn ## Then it runs doplot10 to show the history (logbook) in various ways while( (i = input("which initial condition? (1-6, or 0 to end) ") ) ) ############################################### ## Set the initial conditions ############################################### # Duration of simulation, and time-step; and initial time T = 1000 ; dt = 1 ; t = 0 ; ################################################ # Initial condition for position and velocity ################################################ x = [ 93 , 0 ] ; # x has dimensions [L] theta = 0.5 ; # angle for rotating the velocity, dimensionless [1] M = [ cos(theta) sin(theta) ; -sin(theta) cos(theta) ] ; # rotation matrix, dimensionless # choice of initial condition if(i==1) v = [0,1.1] ; elseif(i==2) v = [0,1.1] * M ; elseif(i==3) v = [0,1.6] ; elseif(i==4) v = [0,1.6] * M ; elseif(i==5) v = [0,2.0] * M ; else v = [0,2.5] * M ; endif # v has dimensions [L/T] ################################################ # setting this to a value greater than zero # causes plots to occur, and defines the duration of pause while plotting (in seconds) plotduring=-1; ##0.015; velocityfactor=10; ## velocityfactor has dimensions [T] - it specifies how to render the velocity ## (with a vector of size v*velocityfactor [ x , v , t , logbook ] = planet10( x , v , t , T , dt , plotduring , velocityfactor ); doplot10 i = input("would you like to see the plot of energies also? (1=yes) ") ; if(i) doplot20 endif endwhile