| 1 | initial version |
I'm not sure how minpoly() works but I'm pretty sure the following numerical approach (using PSLQ) is different:
z = AA(sqrt(3)+sqrt(2))
max_degree = 4
from mpmath import mp, findpoly
mp.dps = 15 # decimal places
f = ZZ['x'](findpoly(z, max_degree))
print(f)
print(f(z))
print(f.roots(SR))
Output:
x^4 - 10*x^2 + 1
0.?e-16
[(-sqrt(2*sqrt(6) + 5), 1), (sqrt(2*sqrt(6) + 5), 1), (-sqrt(-2*sqrt(6) + 5), 1), (sqrt(-2*sqrt(6) + 5), 1)]
It can be used to find minimal polynomials with some degree of uncertainty, but likely at a higher speed. I hope it can be useful.
| 2 | No.2 Revision |
I'm not sure how minpoly() works but I'm pretty sure the following numerical approach (using PSLQ) is different:
z = AA(sqrt(3)+sqrt(2))
max_degree = 4
from mpmath import mp, findpoly
mp.dps = 15 # decimal places
f = ZZ['x'](findpoly(z, ZZ['x'](findpoly(z.numerical_approx(digits=mp.dps), max_degree))
print(f)
print(f(z))
print(f(z.numerical_approx(digits=mp.dps)))
print(f.roots(SR))
Output:
x^4 - 10*x^2 + 1
0.?e-16
1.31006316905768e-14
[(-sqrt(2*sqrt(6) + 5), 1), (sqrt(2*sqrt(6) + 5), 1), (-sqrt(-2*sqrt(6) + 5), 1), (sqrt(-2*sqrt(6) + 5), 1)]
It can be used to find minimal polynomials with some degree of uncertainty, but likely at a higher speed. I hope it can be useful.
| 3 | No.3 Revision |
I'm not sure how minpoly() works but I'm pretty sure the following numerical approach (using PSLQ) is different:
z = AA(sqrt(3)+sqrt(2))
max_degree = 4
from mpmath import mp, findpoly
mp.dps = 15 # decimal places
f = ZZ['x'](findpoly(z.numerical_approx(digits=mp.dps), max_degree))
print(f)
print(f(z.numerical_approx(digits=mp.dps)))
print(f(z).is_zero())
print(f.roots(SR))
Output:
x^4 - 10*x^2 + 1
1.31006316905768e-14
True
[(-sqrt(2*sqrt(6) + 5), 1), (sqrt(2*sqrt(6) + 5), 1), (-sqrt(-2*sqrt(6) + 5), 1), (sqrt(-2*sqrt(6) + 5), 1)]
It can be used to find minimal polynomials with some degree of uncertainty, but likely at a higher speed. I hope it can be useful.
| 4 | No.4 Revision |
I'm not sure how minpoly() works but I'm pretty sure the following numerical approach (using PSLQ) is different:
z = AA(sqrt(3)+sqrt(2))
max_degree = 4
from mpmath import mp, findpoly
mp.dps = 15 # decimal places
f = ZZ['x'](findpoly(z.numerical_approx(digits=mp.dps), max_degree))
print(f)
print(f(z.numerical_approx(digits=mp.dps)))
print(f(z).is_zero())
print(f.roots(SR))
Output:
x^4 - 10*x^2 + 1
1.31006316905768e-14
True
[(-sqrt(2*sqrt(6) + 5), 1), (sqrt(2*sqrt(6) + 5), 1), (-sqrt(-2*sqrt(6) + 5), 1), (sqrt(-2*sqrt(6) + 5), 1)]
It can be used to find minimal polynomials with some degree of uncertainty, but likely at a higher speed. I hope it can be useful.
Edit: The uncertainty of z being a root can be eliminated by checking f(z).is_zero(), and the uncertainty of minimality could be eliminated e.g. by checking f.is_irreducible().
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.