IntegerRelations
PSLQ
find an integer dependence (relation)
Calling Sequence
Parameters
Description
Examples
PSLQ(v)
v
-
list or Vector of (complex) floating-point numbers
Given a list (or a Vector) v of n real numbers, the PSLQ(v) command outputs a list (or a Vector) u of n integers such that ∑i=1n⁡ui⁢vi is minimized. Thus the PSLQ function finds an integer relation between a vector of linearly dependent real numbers if the input has enough precision.
Given a list (or a Vector) v of n complex numbers, the PSLQ(v) command outputs a list (or a vector) u of n complex integers (Gaussian integers) such that the norm of ∑i=1n⁡ui⁢vi is minimized.
This is an implementation of Bailey and Ferguson's PSLQ algorithm. You can also use the Lenstra-Lenstra-Lovasz (LLL) lattice reduction algorithm to find a linear relation. For more information, see IntegerRelations[LLL]. Generally speaking, PSLQ is faster.
One application of PSLQ is to find the minimal polynomial of an algebraic number given a decimal approximation of the algebraic number. The examples below illustrate this. Generally speaking, if the height of the minimal polynomial is m and its degree is n, then you need more than n⁢log10m correct decimal digits for the algebraic number. If the input has d digits and this is insufficient, the output of PSLQ will typically be a list of n integers each with approximately d/n digits long.
with⁡IntegerRelations:
v≔1.570796326,1.414213562,−1.101048032
u≔PSLQ⁡v
u≔−2,3,1
Check that the following linear combination is small.
u1⁢v1+u2⁢v2+u3⁢v3
2.×10−9
Finding a integer relation between non-algebraic constants.
Logs≔Vector⁡log⁡2,log⁡3,log⁡5,log⁡6,log⁡10
Logs≔ln⁡2ln⁡3ln⁡5ln⁡6ln⁡10
u≔PSLQ⁡Logs
u≔1010−1
Relation≔add⁡Logsi⁢ui,i=1..5=0
Relation≔ln⁡2+ln⁡5−ln⁡10=0
Using PSLQ to find the minimal polynomial for 2+3.
r≔sqrt⁡2+sqrt⁡3
r≔2+3
v≔expand⁡seq⁡ri,i=0..4
v≔1,2+3,5+2⁢2⁢3,11⁢2+9⁢3,49+20⁢2⁢3
Approximate with 12 digits and round to 10 digits.
v≔evalf⁡v,12
v≔1.,3.14626436994,9.89897948556,31.1448064542,97.9897948556
v≔evalf⁡v
v≔1.,3.146264370,9.898979486,31.14480645,97.98979486
u≔1,0,−10,0,1
add⁡ui⁢vi,i=1..5
0.
The minimal polynomial for r
m≔add⁡ui⁢zi−1,i=1..5
m≔z4−10⁢z2+1
Check that r is a root of m⁡z
simplify⁡eval⁡m,z=r
0
The next example involves complex numbers. First define a tenth root of unity.
r≔cos⁡π5+I⁢sin⁡π5
a≔evalf⁡r
a≔0.8090169943+0.5877852524⁢I
v≔1,a,a2,a3,a4:
u≔1,−1,1,−1,1
−1.×10−10−3.×10−10⁢I
m≔add⁡ui+1⁢zi,i=0..4
m≔z4−z3+z2−z+1
In the next example, a Gaussian integer relation is found. We subsequently find an integer relation from the Gaussian integer relation by eliminating I.
r≔sqrt⁡1+2⁢I
r≔1+2⁢I
v≔evalf⁡1,r,r2
v≔1.,1.272019650+0.7861513778⁢I,1.+2.⁢I
u≔1+2⁢I,0,−1
m≔u1+u2⁢x+u3⁢x2
m≔−x2+1+2⁢I
eval⁡m,x=r
m≔subs⁡I=z,m
m≔−x2+2⁢z+1
m≔resultant⁡m,z2+1,z
m≔x4−2⁢x2+5
The last example is of much larger degree requiring more than the default 10 digits of precision. In the example, we are using PSLQ to test if the algebraic number r is of degree 10 or less.
r≔1+213−313
Digits≔50
interface⁡rtablesize=11:
v≔Vector⁡seq⁡ri,i=0..10:
Compute to 55 digits and round to 50 digits.
v≔evalf⁡v,55:
v≔1.0.817671479587464782445572296498118762178382211202160.668586648530753836390483543971910166229642164394990.546684234136565776411464312109300969376621272021810.447008106593585761052607258369896222261607897925050.365505779905968441244634024080702057868267278201940.298863651853483469754883483854486311766559962747220.244372284405950790233523271912297540143492649866490.199816247360382529945733129575962875449437226729790.163384046624778837551147180404856597118847153613490.13359447514467024355385019361427542093983423064155
u≔−1623240−2971082727−4527−81
add⁡ui⁢vi,i=1..11
−1.75×10−48
m≔add⁡ui⁢zi−1,i=1..11
m≔z10−8⁢z9+27⁢z8−45⁢z7+27⁢z6+27⁢z5+108⁢z4−297⁢z3+324⁢z−162
Check.
factor⁡m
z+1⁢z9−9⁢z8+36⁢z7−81⁢z6+108⁢z5−81⁢z4+189⁢z3−486⁢z2+486⁢z−162
Thus, the minimal polynomial for r must be the degree 9 factor.
Here is what happens if we mistakenly assume that algebraic number r is of degree 6 or less. The output of PSLQ looks like random 7 digit integers, which indicates that it has not found anything interesting.
u≔PSLQ⁡v1..7
u≔6336266−44918556130884−120731163103150−60126782169170
add⁡ui⁢vi,i=1..7
1.99×10−42
See Also
identify
IntegerRelations[LinearDependency]
IntegerRelations[LLL]
Download Help Document
What kind of issue would you like to report? (Optional)