Skip to content

Instantly share code, notes, and snippets.

@alogic0
Created January 27, 2015 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alogic0/e390c487d8874837e816 to your computer and use it in GitHub Desktop.
Save alogic0/e390c487d8874837e816 to your computer and use it in GitHub Desktop.
Constants and formulae for IntroAstro on Coursera
import Data.Ratio
mS=19891*10^26 % 1 --in kg Sun mass
mE=597219*10^19 % 1 --in kg Earth mass
rE=6371000 % 1 --in m Earth radius
tE=3652564 % 10000 --in days Earth siderial year
mM=73477*10^18 % 1 --in kg Moon mass
rM=1737500 % 1 --in m Moon radius
aU=149597870691 % 1 --in m distance to Sun
gN=6673 % (10^14) --in m3/(kg*s2) gravitational constant G
gE=gN*mE/rE^2 --in m/s2 Earth g
pI=3141592653589793 % 10^15
kB=1381 % 10^26 --in J/K Boltsman constant
mH=6647 % 10^30 --in kg Helium atom mass
mA=51480*10^14 % 1 --in kg mass of Earth atmosphere
amu=16605389 % 10^34 --in kg atomic mass unit
bW=29 % 10^4 --in m*K Wien constant lambda * T = bW
nM=1 % 10^9 --in m nanometr
sF=5670 % 10^11 --in W/(m2K4) flux F = sF * T^4
hP = 6626 % 10^37 --in J*s Planck constant E = hP * f; lambda = c/f
-- speed Ison comet in perihelion in m/s
spIsn = sqrt $ fromRational $ 2*gN*mS*(1%1000)*(1/1860000 - 1/(13933*aU))
-- energy of asteroid
astEr = fromRational $ (gN * mE * 4 * pI * 2000^3 * 2500)/(3*rE)
astSol = fromRational $ (2 % 3) * (gN * mS * 4 * pI * 2000^3 * 2500)/(3*aU)
tNur = fromRational $ 1/(1 - tE/374) --year on Nursat in Earth years
dNur = tNur ** (2/3) --Nursat orbin in AU
rNur = (toRational dNur - 1)*aU*pI*(71523/(10000*60*60))/180 --in m Nursat radius
mNur = fromRational $ (4*pI^2*(2606/1000*rNur)^3/(gN*(6947/10000*24*60*60)^2))/mE --Nursat mass in mE
vH = sqrt $ fromRational $ (3 * kB * 1800)/mH --speed of Helium atom
v1000=sqrt $ fromRational $ 2* gN * mE /(rE+1000*1000)
{- 5x10-3 > 6000
7x10-6 > 10000
-}
ds=(7e-6/5e-3)**(1/4)
prtH=5e-3*(ds**((v1000-6000)/1000))
aP=gE*mA/(4*pI*rE^2) --in N/m2 atmosphere pressure
{- n=N/V; P=n*kB*T; rho = n*mu; aP=rho/mu * kB * T -}
muA = let t=27315 % 100
rho=12922 % 10000
in rho*kB*t/(aP*amu)
lAld = let t=3934
in bW/(t*nM)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment