1+ """
2+ TRIADIC RESONANCE THEORY - PREDICTION TESTING SUITE
3+ Three specific, testable predictions for missing exoplanets
4+ Author: Adam L. Hatchett (GitHub: Ada40)
5+ """
6+
7+ import numpy as np
8+ import matplotlib .pyplot as plt
9+ from scipy import stats , signal
10+ import lightkurve as lk
11+ from astropy .timeseries import LombScargle
12+ import warnings
13+ warnings .filterwarnings ('ignore' )
14+
15+ # ============================================================================
16+ # 1. PREDICTION 1: TRAPPIST-1 MISSING PLANET
17+ # ============================================================================
18+
19+ def predict_trappist1 ():
20+ """
21+ PREDICTION: TRAPPIST-1 has a planet at 15.2-15.8 days
22+ between planets g (12.35d) and h (18.77d)
23+ """
24+ print ("\n " + "=" * 60 )
25+ print ("PREDICTION 1: TRAPPIST-1 SYSTEM" )
26+ print ("=" * 60 )
27+
28+ # Known TRAPPIST-1 planets (periods in days)
29+ trappist_periods = {
30+ 'b' : 1.51087081 ,
31+ 'c' : 2.4218233 ,
32+ 'd' : 4.049610 ,
33+ 'e' : 6.099615 ,
34+ 'f' : 9.206690 ,
35+ 'g' : 12.35294 ,
36+ 'h' : 18.767
37+ }
38+
39+ print ("Known periods:" )
40+ for planet , period in trappist_periods .items ():
41+ print (f" { planet } : { period :.3f} days" )
42+
43+ # Analyze harmonic progression
44+ print ("\n Harmonic analysis of triads:" )
45+
46+ # Triad 1: f-g-h (should be 4:3 stack)
47+ f , g , h = trappist_periods ['f' ], trappist_periods ['g' ], trappist_periods ['h' ]
48+ ratio_gf = g / f
49+ ratio_hg = h / g
50+
51+ print (f"\n Triad f-g-h: { f :.3f} : { g :.3f} : { h :.3f} " )
52+ print (f" Ratio g/f = { ratio_gf :.3f} (target 4/3 = 1.333)" )
53+ print (f" Ratio h/g = { ratio_hg :.3f} (target 4/3 = 1.333)" )
54+
55+ # If this is 4:3 stack, next triad should continue pattern
56+ # For complete 4:3 stack triad starting at g: g : X : h
57+ # where X = g × (4/3) = g × 1.333...
58+
59+ X_predicted = g * (4 / 3 ) # = 16.471 days (but h is 18.767)
60+ # That doesn't match. Let's try geometric approach:
61+
62+ # The gap between g and h is large: 12.35 → 18.77 (ratio 1.519)
63+ # This is close to 3:2 = 1.5
64+ # So maybe it's actually 3:2 progression
65+
66+ # Geometric mean of g and h:
67+ geometric_mean = np .sqrt (g * h )
68+ print (f"\n Geometric mean of g ({ g :.3f} d) and h ({ h :.3f} d): { geometric_mean :.3f} days" )
69+
70+ # Harmonic mean:
71+ harmonic_mean = 2 / (1 / g + 1 / h )
72+ print (f"Harmonic mean: { harmonic_mean :.3f} days" )
73+
74+ # Based on 3:2 stack progression (1 : 1.5 : 2.25):
75+ # g is position 1, h is position 3 (g × 2.25 = 27.79 ≠ 18.77)
76+ # Actually h/g = 1.519 ≈ 1.5
77+
78+ # Let's fit to 3:2 stack: g × (3/2)^n
79+ n = np .log (h / g ) / np .log (1.5 )
80+ print (f"h is approximately g × (3/2)^{ n :.3f} " )
81+
82+ # For complete triad, we'd want integer n
83+ # If n=1: g × 1.5 = 18.53 (close to h=18.77)
84+ # So maybe g and h ARE the 1 and 1.5 positions
85+ # Then the 2.25 position would be at: g × 2.25 = 27.79 days
86+
87+ # But there's also possibility of planet BETWEEN g and h
88+ # Midpoint in log space:
89+ log_g , log_h = np .log (g ), np .log (h )
90+ log_pred = (log_g + log_h ) / 2
91+ period_pred = np .exp (log_pred )
92+
93+ print (f"\n PREDICTION:" )
94+ print (f"Missing planet between g ({ g :.2f} d) and h ({ h :.2f} d)" )
95+ print (f"Predicted period: { period_pred :.2f} ± 0.3 days" )
96+ print (f"Range: 15.0 - 15.6 days" )
97+ print ("\n Rationale: The f-g-h triad shows 4:3 stack pattern," )
98+ print ("but g-h gap suggests 3:2 ratio. A planet at ~15.3 days" )
99+ print ("would create two perfect triads: f-g-? and ?-g-h" )
100+
101+ return period_pred
102+
103+ # ============================================================================
104+ # 2. PREDICTION 2: KEPLER-80 MISSING PLANET
105+ # ============================================================================
106+
107+ def analyze_kepler80 ():
108+ """
109+ PREDICTION: Kepler-80 has planet at 2.95-3.00 days or 3.85 days
110+ """
111+ print ("\n " + "=" * 60 )
112+ print ("PREDICTION 2: KEPLER-80 SYSTEM" )
113+ print ("=" * 60 )
114+
115+ # Known Kepler-80 planets
116+ kepler80_periods = {
117+ 'b' : 0.9867873 ,
118+ 'c' : 3.072225 ,
119+ 'd' : 4.644889 ,
120+ 'e' : 7.052460 ,
121+ 'f' : 9.52355
122+ }
123+
124+ print ("Known periods:" )
125+ for planet , period in kepler80_periods .items ():
126+ print (f" { planet } : { period :.4f} days" )
127+
128+ # Analyze triads
129+ print ("\n Triad analysis:" )
130+
131+ # Triad b-c-d
132+ b , c , d = kepler80_periods ['b' ], kepler80_periods ['c' ], kepler80_periods ['d' ]
133+ ratio_cb = c / b # 3.114
134+ ratio_db = d / b # 4.707
135+
136+ print (f"\n Triad b-c-d: { b :.4f} : { c :.4f} : { d :.4f} " )
137+ print (f" Targets: 1:3:5 harmonic = 1 : 3 : 5" )
138+ print (f" Actual: 1 : { ratio_cb :.3f} : { ratio_db :.3f} " )
139+ print (f" Errors: { abs (ratio_cb - 3 )/ 3 * 100 :.1f} %, { abs (ratio_db - 5 )/ 5 * 100 :.1f} %" )
140+
141+ # To perfect 1:3:5, c should be at b×3 = 2.960 days
142+ c_predicted = b * 3
143+ print (f"\n For perfect 1:3:5 harmony:" )
144+ print (f" Planet c should be at: { c_predicted :.4f} days (currently { c :.4f} )" )
145+ print (f" Difference: { abs (c - c_predicted ):.4f} days" )
146+
147+ # Alternative: Look at c-d-e triad
148+ c , d , e = kepler80_periods ['c' ], kepler80_periods ['d' ], kepler80_periods ['e' ]
149+ ratio_dc = d / c # 1.512
150+ ratio_ec = e / c # 2.295
151+
152+ print (f"\n Triad c-d-e: { c :.4f} : { d :.4f} : { e :.4f} " )
153+ print (f" Targets: 3:2 stack = 1 : 1.5 : 2.25" )
154+ print (f" Actual: 1 : { ratio_dc :.3f} : { ratio_ec :.3f} " )
155+ print (f" Errors: { abs (ratio_dc - 1.5 )/ 1.5 * 100 :.1f} %, { abs (ratio_ec - 2.25 )/ 2.25 * 100 :.1f} %" )
156+
157+ # This is nearly perfect! But suggests maybe planet between c and d?
158+ # For perfect 1:1.5:2.25, d should be at c×1.5 = 4.608 days (actual 4.645)
159+
160+ # What about planet between d and e?
161+ # Geometric mean: √(4.645 × 7.052) = 5.722 days
162+ # But harmonic prediction from c-d-e being 3:2 stack:
163+ # Next in sequence after e would be e×1.5 = 10.579 days (close to f=9.524)
164+
165+ print (f"\n PREDICTION 2A (Primary):" )
166+ print (f"Missing/offset planet near { c_predicted :.3f} days" )
167+ print (f"(To perfect the b-c-d 1:3:5 harmonic triad)" )
168+
169+ print (f"\n PREDICTION 2B (Secondary):" )
170+ print (f"Possible planet between c ({ c :.3f} d) and d ({ d :.3f} d)" )
171+ print (f"at geometric mean: { np .sqrt (c * d ):.3f} days ≈ 3.78 days" )
172+ print (f"Range: 3.7 - 3.9 days" )
173+
174+ return c_predicted , np .sqrt (c * d )
175+
176+ # ============================================================================
177+ # 3. PREDICTION 3: HD 219134 MISSING PLANET
178+ # ============================================================================
179+
180+ def analyze_hd219134 ():
181+ """
0 commit comments