-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprove_recurrence.py
More file actions
47 lines (32 loc) · 1.2 KB
/
Copy pathprove_recurrence.py
File metadata and controls
47 lines (32 loc) · 1.2 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
"""Symbolic induction step for the exact t=3 vector-sector sequences."""
import sys
from pathlib import Path
if Path("/private/tmp/bb_sympy").is_dir():
sys.path.insert(0, "/private/tmp/bb_sympy")
import sympy as s
n = s.symbols("n", integer=True, positive=True)
def q(k):
return (9 * k**2 - 30 * k + 20) / s.Integer(4) ** k
def w(k):
return -s.Rational(2, 3) * k * (2 * k - 5) * (3 * k - 5) / s.Integer(4) ** k
A = s.Rational(3, 20) * (n + 3) / (n + 1)
B = s.Rational(3, 20) * (n + 4) / n
C = s.Rational(1, 20) * (n + 3) * (n + 4) / (n * (n + 1))
q_residual = s.factor(
q(n + 5) - (A * q(1) * q(n + 4) - B * q(2) * q(n + 3) + C * q(3) * q(n + 2))
)
w_residual = s.factor(
w(n + 5)
- (
A * (w(1) * q(n + 4) + q(1) * w(n + 4))
- B * (w(2) * q(n + 3) + q(2) * w(n + 3))
+ C * (w(3) * q(n + 2) + q(3) * w(n + 2))
)
)
x = s.Rational(1, 4)
infinite_symbol = s.simplify(6 * x * (1 + x) / (1 - x) ** 3 - 10 * x / (1 - x) ** 2)
print("q recurrence residual:", q_residual)
print("w recurrence residual:", w_residual)
print("infinite vector symbol:", infinite_symbol)
raise SystemExit(0 if q_residual == w_residual == infinite_symbol == 0 else 1)