-
Notifications
You must be signed in to change notification settings - Fork 0
/
mercury-classical-num-stability-plot.py
34 lines (24 loc) · 8.87 KB
/
mercury-classical-num-stability-plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import matplotlib.pyplot as plt
def config_inset(inset, x1, x2, y1, y2):
inset.set_xlim(x1, x2)
inset.set_ylim(y1, y2)
inset.set_xticklabels([])
inset.set_yticklabels([])
fig, axes = plt.subplots()
inset1 = axes.inset_axes([0.25, 0.15, 0.5, 0.55])
config_inset(inset1, -3.13e+7, -3.03e+7, -2.7e+6, -1.7e+6)
inset2 = inset1.inset_axes([0.5, 0.2, 0.4, 0.7])
config_inset(inset2, -3.10877e+7, -3.10848e+7, -2.2751e+6, -2.1998e+6)
for year, r_max, u_min, x, y in [(1, 47279994.54891714, 0.00012962300772284828, [47279994.64428885, 47202795.41950712, 46971501.41682853, 46587022.85396611, 46050873.04800196, 45365162.46210742, 44532590.40131791, 43556434.38974499, 42440537.271189794, 41189292.08384363, 39807624.76853706, 38300974.77855665, 36675273.6675174, 34936921.73922375, 33092762.851744324, 31150057.474592783, 29116454.105279006, 26999959.157518215, 24808905.439817846, 22551919.348287184, 20237886.902979072, 17875918.761432942, 15475314.347111372, 13045525.23392065, 10596117.931023367, 8136736.214497235, 5677063.15407052, 3226782.984546325, 795542.9720575645, -1607084.5746565566, -3971639.9982952382, -6288813.543866006, -8549482.019598098, -10744744.723428564, -12865958.493446987, -14904771.744139114, -16853157.354270123, -18703444.276677925, -20448347.745328166, -22080997.96056476, -23594967.139406107, -24984294.82416151, -26243511.3496824, -27367659.37663313, -28352313.40607204, -29193597.19832896, -29888199.02780348, -30433384.713631503, -30827008.375094477, -31067520.86960833, -31153975.880397517, -31086033.630121615, -30863962.20618739, -30488636.492837116, -29961534.714626715, -29284732.605251886, -28460895.224831592, -27493266.458240256, -26385656.236125745, -25142425.52892248, -23768469.17310317, -22269196.59735762, -20650510.524596497, -18918783.73345499, -17080833.970813088, -15143897.113851516, -13115598.687137008, -11003923.846875954, -8817185.950031977, -6563993.83204116, -4253217.921657565, -1893955.3262326992, 504505.97535479505, 2932723.691292894, 5381138.383149164, 7840111.093717538, 10299961.28834752, 12751004.960455673, 15183592.75132741, 17588147.93409877, 19955204.11247365, 22275442.485763587, 24539728.533503454, 26739147.97527399, 28865041.864202518, 30909040.675812956, 32863097.25809943, 34719518.51308935, 36470995.68501804, 38110633.13610442, 39631975.496208094, 41029033.079678416, 42296305.469436586, 43428803.17507048, 44422067.27980351, 45272186.99902765, 45975815.08107727, 46530180.9895841, 46933101.81552504, 47182990.87601134, 47278863.96593578], [0, 2406950.437189339, 4804426.7112850575, 7182989.861297571, 9533275.34402638, 11846029.903580746, 14112148.003234236, 16322707.676171783, 18469005.653990574, 20542591.634563956, 22535301.554441724, 24439289.734675903, 26247059.773583386, 27951494.064732183, 29545881.82383588, 31023945.514344905, 32379865.567519624, 33608303.29971244, 34704421.9364478, 35663905.66059984, 36482976.609556206, 37158409.754428186, 37687545.602567516, 38068300.6733448, 38299175.705867775, 38379261.566203535, 38308242.830866545, 38086399.03215579, 37714603.56057831, 37194320.22838038, 36527597.50775274, 35717060.46618509, 34765900.43080091, 33677862.42216255, 32457230.40699545, 31108810.4278785, 29637911.67635016, 28050325.583937153, 26352303.013450105, 24550529.64052455, 22652099.622432686, 20664487.657973215, 18595519.548690625, 16453341.377567695, 14246387.426797446, 11983346.96122682, 9673130.00853321, 7324832.271223766, 4947699.308781842, 2551090.1312931273, 144440.34807312328, -2262774.983470813, -4661078.6623544935, -7041028.655017159, -9393255.265937245, -11708498.021624943, -13977642.122910628, -16191754.32225705, -18342118.08504454, -20420267.896747667, -22418022.58111378, -24327517.498631995, -26141235.498649534, -27852036.503662676, -29453185.60950298, -30938379.591055855, -32301771.709286727, -33537994.722021542, -34642182.00813388, -35609986.72187806, -36437598.90202414, -37121760.468602486, -37659778.04785745, -38049533.57524098, -38289492.63445524, -38378710.4994675, -38316835.85599202, -38104112.187384956, -37741376.8195656, -37230057.62855167, -36572167.42346662, -35770296.027020566, -34827600.084677346, -33747790.64246693, -32535118.54222415, -31194357.69163512, -29730786.27506486, -28150165.97895591, -26458719.313553624, -24663105.12013407, -22770392.36022231, -20788032.289879397, -18723829.128626972, -16585909.338320063, -14382689.633070856, -12122843.846007632, -9815268.783340806, -7469049.200196815, -5093422.03598555, -2697740.0501845554, -291435.00166096934]), (900, 47279994.778881624, 0.00012962300721507472, [47279994.38569324, 47203187.15728051, 46972283.61056602, 46588192.42607551, 46052425.3957552, 45367091.4757229, 44534888.48799614, 43559092.50356181, 42443544.94873392, 41192637.48536577, 39811294.72454097, 38304954.84167234, 36679548.169319905, 34941473.85196171, 33097574.65454776, 31155110.02403099, 29121727.509976838, 27005432.65646454, 24814557.484060634, 22557727.685790285, 20243828.666244593, 17881970.557529885, 15481452.349750979, 13051725.277290298, 10602355.604958221, 8142986.960581579, 5683302.3623406915, 3232986.0903962655, 801685.5529667765, -1601026.7029461577, -3965690.6865481175, -6282996.215436563, -8543819.578187365, -10739259.46289024, -12860672.009999335, -14899704.851309104, -16848330.00093892, -18698875.468513764, -20444055.46996199, -22076999.11675458, -23591277.470494565, -24980928.85607957, -26240482.33376574, -27364979.23746059, -28349992.694499873, -29191645.04998342, -29886623.127144065, -30432191.26369239, -30826202.07308942, -31067104.888504066, -31153951.856424455, -31086401.656330854, -30864720.832118683, -30489782.73027574, -29963064.049414404, -29286639.015063785, -28463171.202914637, -27495903.043014474, -26388643.0464503, -25145750.804944247, -23772119.82261582, -22273158.24735565, -20654767.577832248, -18923319.429843627, -17085630.45341319, -15148935.499153048, -13120859.13940569, -11009385.65621027, -8822827.613882503, -6569793.139847255, -4259152.042285901, -1900000.8978296355, 498372.75341815175, 2926526.964728464, 5374902.547717455, 7833860.699197572, 10293720.94189485, 12744799.229759397, 15177446.067875907, 17582084.49703177, 19949247.793295138, 22269616.73437951, 24534056.285894502, 26733651.563237675, 28859742.927422553, 30903960.07665096, 32858254.999481607, 34714933.65971383, 36466686.28836894, 38106616.16329732, 39628266.76318209, 41025647.18899291, 42293255.75274196, 43426101.640583925, 44419724.565054335, 45270212.32899881, 45974216.23178218, 46528964.257500656, 46932271.99284094, 47182551.23170451, 47278816.232820496], [-6116.7588267971105, 2400845.6861076425, 4798358.003082868, 7176981.08934637, 9527350.165865527, 11840211.647770628, 14106459.577513048, 16317171.477257945, 18463643.47938125, 20537424.596735585, 22530349.997715164, 24434573.155112177, 26242596.742207896, 27947302.15437643, 29541977.539962184, 31020344.230057, 32376581.463048153, 33605349.30653425, 34701809.68634703, 35661645.43989278, 36481077.31859812, 37156878.87252969, 37686389.15852856, 38067523.22169253, 38298780.30885748, 38379249.781820096, 38308614.70669807, 38087153.105200864, 37715736.86294965, 37195828.29897401, 36529474.40988374, 35719298.81094553, 34768491.406111695, 33680795.82741521, 32460494.693277806, 31112392.743448973, 29641797.91729528, 28054500.449665338, 26356750.066943496, 24555231.37312044, 22657037.522738736, 20669642.28478587, 18600870.60755853, 16458867.800724108, 14252067.456129828, 11989158.233945787, 9679049.64526332, 7330836.966099849, 4953765.421211273, 2557193.779054162, 150557.5013394607, -2256668.4075160236, -4655006.704704562, -7035015.220194128, -9387324.027887596, -11702672.330525508, -13971944.913262356, -16186208.022607744, -18336744.52971754, -20415088.239882924, -22413057.213463753, -24322785.967268016, -26136756.43003039, -27847827.530351926, -29449263.30077071, -30934759.387641437, -32298467.862623747, -33535020.23816979, -34639548.59654532, -35607704.749355316, -36435677.35193977, -37120206.90548786, -37658598.58763937, -38048732.861195326, -38289073.818872705, -38378675.231275216, -38317184.27424976, -38104842.92069461, -37742486.991457194, -37231542.86878672, -36574021.885250024, -35772512.41005565, -34830169.66384993, -33750703.30216635, -32538362.816140622, -31197920.807913505, -29734654.206572335, -28154323.49850179, -26463150.053786103, -24667791.637968495, -22775316.205545753, -20793174.078129955, -18729168.617126983, -16591425.505951686, -14388360.763024636, -12128647.61127443, -9821182.334618699, -7475049.255827412, -5099484.973610945, -2703841.999737492, -297551.9393422611])]:
plt.plot(x, y, label=f'{year}, {r_max / 47279994.64428885:.4g}, {u_min / 0.00012962300739400188:.3g}')
inset1.plot(x, y)
inset2.plot(x, y)
plt.title("""Classical interaction - Sun-Mercury
Numerical stability of the Verlet integration
u[0] = 1.296e-04 r%[0] = 4.728e+07""")
plt.legend(title='period, r_max / r[0], u_min / u[0]', loc='upper right')
plt.xlabel('r_x%')
plt.ylabel('r_y%')
axes.indicate_inset_zoom(inset1)
inset1.indicate_inset_zoom(inset2)
plt.show()