File: acoaster.ode

package info (click to toggle)
xppaut 8.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,332 kB
  • sloc: ansic: 74,690; makefile: 127; sh: 92
file content (49 lines) | stat: -rwxr-xr-x 1,055 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#Hey, define your roller coaster track here!
#Use parametric equations in M.
xM(M) = sin(alpha*M)
zM(M) = gamma*cos(beta*M+delta)

#Now calculate and put the derivatives of your
#parametric equations here:
xMdM(M) = alpha*cos(alpha*M)
zMdM(M) = -gamma*beta*sin(beta*M+delta)

par alpha=3,beta=1,gamma=1,delta=0
param drag=.1
param mass=1
param g=8.3
# scale mouse velocity a little as it is too sensitive
par sv=.25
init M=0,X=0,Z=1
init L=0,Lalt=0.001

#Shouldn't need to modify too much below...

normM(M) = sqrt(xMdM(M)^2 + zMdM(M)^2)
mdt(M) = Lalt/normM(M)

dX/dt=xMdM(M)*mdt(M)
dZ/dt=zMdM(M)*mdt(M)
dM/dt=mdt(M)
dL/dt=Lalt
#Thanks to Newton!
dLalt/dt=(1/mass)*((-g*zMdM(M)/normM(M)) - drag*Lalt)

set Sun     {g=274.13} 	
set Mercury {g=3.59}	
set Venus   {g=8.87}    
set Earth   {g=9.81}    
set Moon    {g=1.62}    
set Mars    {g=3.77}   
set Jupiter {g=25.95}
set Saturn  {g=11.08}    
set Uranus  {g=10.67}    
set Neptune {g=14.07} 
set Pluto   {g=0.42}
 
@ XP=X,YP=Z,XLO=-1,XHI=1,YLO=-1,YHI=1
@ bounds=100000
@ dt=.01,nout=5
@ total=50
done