import math
def earth_settings():
"""
地球の基本設定を返す関数。
Returns:
dict: 地球の各種設定をまとめた辞書。
"""
earth = {
"radius": 6_371_000,
"mass": 5.972e24,
"surface_gravity": 9.8,
"rotation_velocity": 465,
"gravitational_constant": 6.674e-11,
"escape_velocity": None,
"orbital_velocity": None,
"karman_line": 100_000,
}
earth["escape_velocity"] = math.sqrt(2 * earth["gravitational_constant"] * earth["mass"] / earth["radius"])
earth["orbital_velocity"] = math.sqrt(earth["gravitational_constant"] * earth["mass"] / earth["radius"])
return earth
earth = earth_settings()
print("地球の設定:")
print(f"半径: {earth['radius'] / 1000:.1f} km")
print(f"質量: {earth['mass']:.2e} kg")
print(f"表面重力加速度: {earth['surface_gravity']} m/s²")
print(f"赤道自転速度: {earth['rotation_velocity']} m/s")
print(f"脱出速度: {earth['escape_velocity']:.1f} m/s")
print(f"第一宇宙速度: {earth['orbital_velocity']:.1f} m/s")
print(f"カーマンライン高度: {earth['karman_line'] / 1000:.1f} km")