Fri Aug 16 1996 Mika Heiskanen mheiskan@delta.hut.fi The intention of this article is to promote discussion and experimentation in order to get a useful set of equations for recognizing numerical constants. The QPI library would then be expanded in the future to include a command for finding the specified relations. A library and a source code for the PSLQ algorithm is provided at the end. The library includes a sample implementation of an interface to the PSLQ algorithm. PSLQ is an algorithm which given a real number input vector x = [ x1 x2 x3 .. xn ] finds an integer vector a = [ a1 a2 a3 .. xn ] so that a1*x1 + a2*x2 + ... + an*xn = 0 With the algorithm one can for example find a solution to a1*PI^2+a2*PI x = ------------- a3 by giving the [ PI^2 PI x ] vector as input to the algorithm. Other approximations for real numbers can be found similarly. The library provided here contains an assembly language implementation of the PSLQ algorithm. However due to the restricted precision and speed of the HP48 the set of approximations has to be carefully crafted to avoid unnecessarily complex output as well as too long run times. Here I will need the input of the potential users on which combinations the program should be able to find, and thus the library is made available at this stage already. The library commands are Name: QFI Stack: ( real --> { list of found relations } ) Notes: ON-key aborts and returns relations found so far Name: PSLQ Stack: ( x_vector --> a_vector ) Notes: ON-key aborts For example to see if X=0.44224957031 is a root of some small degree polynomial one can use input vector [ X^5 X^4 X^3 X^2 X 1 ] for which PSLQ returns in 8.8s the vector [ 0 -1 -3 -3 2 0 ] 4 3 2 indicating -X -3X -3X +2X = 0, which the DOT product with the input vector verifies (-5.9E-12). The extra 'X' factor can of course be removed so that the number is actually a root of a cubic equation, in this case the root being 3^(1/3)-1. The QFI command is an interface to the PSLQ algorithm which sets up some sample vectors and returns the found relations. The equations tested are 2 AX +BX+C = 0 A ASIN(X) = B PI + C 2 _ _ _ AX = B + C /2 + D /3 + E /5 2 __ AX = B PI + C PI + D /PI + E Some sample inputs and outputs follow 1/2 '1/2' [6.0s] 'SIN(1/6*PI)' 'SQRT(1/4)' '1/2' -3/7 '-3/7' [15.5s] 'SIN(-262/132467*PI+57848/132467)' '-SQRT(9/49)' '-3/7' SQRT(2)-1 '-1+SQRT(2)' [18.4s] 'SIN(63320/10763*PI-194329/10763)' 'SQRT(3-2*SQRT(2))' '-106/271*PI^2+184/271*PI+284/271*SQRT(PI)+77/271' 2*PI-3*SQRT(PI) '92075/196512+1/393024*SQRT(38197542244)' [20.0s] 'SIN(81795/88909*PI-140620/88909)' 'SQRT(-125/124+17/62*SQRT(2)-5/124*SQRT(3)+45/62*SQRT(5))' '2*PI-3*SQRT(PI)' In this current first implementation QFI merely requires the norm of the output vector to be less than 1E6 before disregarding the found solution, this explains the seemingly unreasonable approximations. For example the norms in the last test are 269365, 185389, 201 and 4 respectively. On the other hand PSLQ sometimes doesn't seem to find the smallest norm solution: -- / 2 + 1 93660 1 ------------ ------- ==> ------ + ------ / 28022085216 2 146929 293858 1.20710678118 654.. 1.20710678118 001.. As can be seen the latter is closer to the input due to real number accuracy so this might be solved later on by improving the the exit conditions in the implementation of the PSLQ algorithm. For more information on PSLQ see http://www.cecm.sfu.ca/organics/papers/bailey/paper/html/paper.html http://www.cecm.sfu.ca/projects/ISC