Post Reply 
Astrophysics programs
07-13-2019, 04:14 AM
Post: #1
Astrophysics programs
Degrad/RadDeg - Degrees to radians and visa-versa
MtoPC/PCtoM - Metres to Parsecs and Parsecs to Metres
Lumin/Flux/Distance - Distance calculations using inverse square law f = L/(4*pi*r^2)
AUtoM/MtoAU - Astronomical units to meters and visa-versa
LYtoM/MtoLY - Light years to metres and Metres to Light Years

All programs call "DISPLAY" to display the result followed by the appropriate units.

Enjoy.

PHP Code:
LBL “DEGRAD” # Degrees to Radians
180
/
“ PI”
ASTO 05
XEQ “DISPLAY”
PI
*
END
 
LBL “RADDEG” 
#Radians to Degrees
180
*
PI
/
“ DEG”
ASTO 05
XEQ “DISPLAY”
END
 
LBL “MTOPC”  
# Metres to Parsecs
XEQ “PARSEC”
/
“ PC”
ASTO 05
XEQ “DISPLAY”
END
 
LBL “LUMIN”    
# Luminance given Flux and Distance
XEQ “LUMINA”
XEQ “LUMIND”
RTN
LBL “LUMINA”
“FLUX 
?
PROMPT
ENTER
“DISTANCE 
?
PROMPT
X
^2
PI
*
4
*
*
RTN
LBL “LUMIND”
“ W”
ASTO 05
XEQ “DISPLAY”
END

LBL 
"FLUX"   # Calculate flux given Luminosity and distance
XEQ “FLUXA”
XEQ “FLUXD”
RTN
LBL “FLUXA”
“LUMINOSITY 
?
PROMPT
ENTER
“DISTANCE 
?
PROMPT
X
^2
PI
*
4
*
/
RTN
LBL “FLUXD”
“ WM
-2”
ASTO 05
XEQ “DISPLAY”
END
 
LBL “DIST” 
#Calculate distance given luminosity and flux
XEQ “DISTA”
XEQ “DISTD”
RTN
LBL “DISTA”
“LUMINOSITY 
?
PROMPT
ENTER
“FLUX 
?
PROMPT
PI
*
4
*
/
SQRT
RTN
LBL “DISTD”
“ M”
ASTO 05
XEQ “DISPLAY”
END
 
LBL “PCTOM”   
# Parsec to metres
XEQ “PARSEC”
*
“ M”
ASTO 05
XEQ “DISPLAY”
END
 
LBL “PARSEC” 
# One parsec in metres
XEQ "AU"
648000
*
PI
/
END
 
LBL “LYTOM” 
# Light year to metres
XEQ "LY"
*
“ M”
ASTO 05
XEQ “DISPLAY”
END

LBL “MTOLY”
XEQ 
"LY"
/
“ LY”
ASTO 05
XEQ “DISPLAY”
END

LBL 
"LY"
299792458     # Speed of light in metres per second
31556952       # Number of seconds in an average year ( 356.2425 days )
*
END

LBL “AUTOM”  
# Astronomical units to metres
XEQ "AU"
*
“ M”
ASTO 05
XEQ “DISPLAY”
END
 
LBL “MTOAU” 
# Metres to Astronomical units
XEQ "AU"
/
“ AU”
ASTO 05
XEQ “DISPLAY”
END
 
LBL 
"AU"  # Astronomocal unit in metres
1495978707
100
*
END

LBL “DISPLAY” 
# Display in fixed or scientifc notation followed by units in R5
10000
FIX 2
X
<>Y  # swap X and Y
X>?
SCI 2
.1
X
<>Y  # swap X and Y
<=?
SCI 2
CLA
ARCL X
ARCL 05
AVIEW
END 
Find all posts by this user
Quote this message in a reply
07-14-2019, 12:53 AM
Post: #2
RE: Astrophysics programs
Oops, the comment next to the number of seconds per year ( 31556952 ) should read 365.2425 days *not* 356.2425 days.

My bad.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)