fork download
  1. # your code goes here
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4.  
  5. # r の範囲(au)
  6. r = np.logspace(np.log10(0.35), np.log10(36), 1000)
  7.  
  8. # ダスト面密度
  9. sigma_d_inner = 71 * (r / 1.0)**(-3/2)
  10. sigma_d_outer = 300 * (r / 1.0)**(-3/2)
  11.  
  12. # ガス面密度
  13. sigma_g = 1.7e4 * (r / 1.0)**(-3/2)
  14.  
  15. # 範囲ごとに分ける
  16. mask_inner = (r >= 0.35) & (r <= 2.7)
  17. mask_outer = (r >= 2.7) & (r <= 36)
  18.  
  19. # グラフ作成
  20. plt.figure(figsize=(8,6))
  21.  
  22. # ダスト面密度(内側)
  23. plt.loglog(
  24. r[mask_inner],
  25. sigma_d_inner[mask_inner],
  26. label=r'$\Sigma_d^{H}=71(r/1\,au)^{-3/2}$'
  27. )
  28.  
  29. # ダスト面密度(外側)
  30. plt.loglog(
  31. r[mask_outer],
  32. sigma_d_outer[mask_outer],
  33. label=r'$\Sigma_d^{H}=300(r/1\,au)^{-3/2}$'
  34. )
  35.  
  36. # ガス面密度
  37. plt.loglog(
  38. r,
  39. sigma_g,
  40. label=r'$\Sigma_g^{H}=1.7\times10^{4}(r/1\,au)^{-3/2}$'
  41. )
  42.  
  43. # 軸ラベル
  44. plt.xlabel('r [au]')
  45. plt.ylabel(r'Surface Density [$kg\,m^{-2}$]')
  46.  
  47. # 凡例
  48. plt.legend()
  49.  
  50. # グリッド
  51. plt.grid(True, which="both", ls="--")
  52.  
  53. # 表示
  54. plt.show()
Success #stdin #stdout 0.56s 55588KB
stdin
Standard input is empty
stdout
Standard output is empty