
#Hey, define your roller coaster track here!
#Use parametric equations in M.
xM(M) = sin(M)
zM(M) = cos(M)

#Now calculate and put the derivatives of your
#parametric equations here:
xMdM(M) = cos(M)
zMdM(M) = -sin(M)


param drag=1.2
param mass=1
param g=8.3

init M=0,X=0,Z=1
init L=0,Lalt=0.01

#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
done
