[준비물]
아나콘다의 spyder 또는 구글 드라이브의 colab
생명가능지대 그래프 그리기
import numpy as np
import matplotlib.pyplot as plt
# 거리에 따른 복사평형과, 반구로 가정한 유효온도
# 상수
a = 5.67e-8
pi = np.pi
# 거리 범위
d = np.linspace(0.1, 100, 1000) * 149.6e9
# 광도 계산
L1 = (4*pi*d**2)*a*(((273.15))**4)*2
L2 = (4*pi*d**2)*a*(((373.15))**4)*2
L_sun = 3.846e+26
# 상대적 광도 계산
L1_rel = L1 / L_sun
L2_rel = L2 / L_sun
# AU 단위로 변환
d_au = d / 149.6e9
# 그래프 그리기
plt.plot(d_au, L1_rel, label='T=0°C')
plt.plot(d_au, L2_rel, label='T=100°C')
# 행성 정보
planet_info = {
'Mercury': {'distance': 0.39, 'luminosity': 1},
'Venus': {'distance': 0.72, 'luminosity': 1},
'Earth': {'distance': 1, 'luminosity': 1},
'Mars': {'distance': 1.52, 'luminosity': 1},
'Jupiter': {'distance': 5.20, 'luminosity': 1},
'Saturn': {'distance': 9.58, 'luminosity': 1},
'Uranus': {'distance': 19.18, 'luminosity': 1},
'Neptune': {'distance': 30.07, 'luminosity': 1}
}
# 행성 정보 그래프에 추가
for planet, info in planet_info.items():
plt.plot(info['distance'], info['luminosity'], 'o', label=planet)
# 그래프 꾸미기
plt.title('Luminosity vs. Distance')
plt.xlabel('Distance (AU)')
plt.ylabel('Relative Luminosity')
plt.xscale('log')
plt.legend()
plt.ylim(0, 5)
plt.xlim(0, 100)
# 그래프 보여주기
plt.show()
광도에 따른 생명가능지대의 폭 알아보기
x축 스케일을 log 스케일이 아닌 일반 스케일이 되도록
# 그래프 꾸미기 부분에서
#plt.xscale('log') #이 부분에 주석 처리를 하여 그래프를 관찰해보자.
plt.legend()
plt.ylim(0, 10)
plt.xlim(0, 10) #x 축과 y축 범위를 알맞게 지정해보자.
광도가 높아질 수록
1. 생명가능지대는 중심별에서 멀어짐.
2. 생명가능지대의 폭은 넓어짐.