Getting started

Either open the file PSLQ.m and click "Run Package" or use something like this:

<<"~/docs/math/mathematica/pslq.m"

Basic Usage

The BBP formula for π.

The classical BBP formula can be found with just machine precision:

x=N[Join[{Pi},Table[Sum[1/(16^k(8k+j)),{k,0,Infinity}],{j,1,7}]]];
PSLQ[x]

Algebraicity of Euler's gamma

Usually more precision is needed. Several hundred or even thousand digits are not uncommon:

PSLQ[N[EulerGamma^Range[0,10],100]]

We can ask for more details:

PSLQ[N[EulerGamma^Range[0,10],100],Verbose->True]

By default, at most $IterationLimit (4096 on my machine) iterations are performed. If we have lots of precision (and a bit of time) we can increase this limit to better our chances of finding a relation (or at least getting better norm bounds):

PSLQ[N[EulerGamma^Range[0,10],1000],MaxIterations->100000]

This becomes especially relevant if we look for relations among many numbers:

PSLQ[N[EulerGamma^Range[0,30],1000],MaxIterations->100000]

Advanced Usage

Example from F-B-A, p. 21.

PSLQ[{11,27,31},StepMonitor->(Print[Inverse[#2]//MatrixForm]&)]

Another example from F-B-A, p. 21.

x=(3^(1/4)-2^(1/4))^Range[0,16];
PSLQ[N[x,185],Gamma->Sqrt[4/3],Verbose->True]

Using less precision PSLQ fails to find the relation:

PSLQ[N[x,100],Verbose->True]