Opt

With Python calculate the “comfort zone” of a star system based on visual magnitude and distance. Example is for Ran aka Epsilon Eridani (at Sol the comfort zone happens to be at 1 AU, what a coincidence!)

#!/usr/bin/env python3
import math
import sys
SUN_ABS_MAG = 4.83
LY_PER_PC = 3.26156
m = float(sys.argv[1])      
d_ly = float(sys.argv[2])
d_pc = d_ly / LY_PER_PC
M = m - 5 * (math.log10(d_pc) - 1)
L = 10 ** ((SUN_ABS_MAG - M) / 2.5)
R = math.sqrt(L)
print(f"Distance           : {d_ly:.3f} ly ({d_pc:.3f} pc)")
print(f"Absolute magnitude : {M:.3f}")
print(f"Luminosity         : {L:.3f} L☉")
print(f"Goldilocks radius  : {R:.3f} AU")

 

Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment