6 /* expect that these are unchanged */
8 guess_exact_value ([123, foo/bar, sin(%e)/2]);
9 [123, foo/bar, sin(%e)/2];
11 /* verify that this is the small number we expect it to be */
12 float (10^(2 - fpprec));
17 (root: float (sin (%pi/12)),
18 L: makelist (root^i, i, 0, 4),
19 m: pslq_integer_relation(%%));
20 [- 1, 0, 16, 0, - 16];
22 is (abs (m . L) < 10^(2 - fpprec));
25 guess_exact_value (0.0);
28 guess_exact_value (1.0);
31 guess_exact_value (float (%pi));
34 guess_exact_value (float (sin (%pi/12)));
37 guess_exact_value (float (1/(1 + f(%e))));
40 guess_exact_value (float ([1/sqrt(7), 11/sqrt(7), 19/sqrt(17)]));
41 [1/sqrt(7), 11/sqrt(7), 19/sqrt(17)];
43 guess_exact_value ([1.5, 2.75, 8.875, -1.5, -2.75, -8.875]);
44 [3/2, 11/4, 71/8, -3/2, -11/4, -71/8];
46 map (guess_exact_value, makelist (float (k/10), k, 1, 9));
47 [1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10];
49 /* example from: https://arminstraub.com/downloads/math/pslq.pdf */
50 guess_exact_value (3.6502815398728847452);
53 /* bug reported to mailing list: guess_exact_value(0.1) triggers division by zero */
54 guess_exact_value(0.1);
57 /* additional cases related to guess_exact_value(0.1) */
59 pslq_integer_relation ([1.0, 0.1, 0.010000000000000002, 0.0010000000000000002, 1.0000000000000002E-4]);
62 pslq_integer_relation (float (makelist (1/10^k, k, 0, 4)));
65 pslq_integer_relation (makelist (0.1^k, k, 0, 4));
68 map (guess_exact_value, [0.125, 0.2, 0.25, float(1/15), float(1/17)]);
69 [1/8, 1/5, 1/4, 1/15, 1/17];
71 foolist: apply ('append, makelist (makelist (p/q, p, 1, 20 - q), q, 1, 19));
72 [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,1/2,1,3/2,2,5/2,3,7/2,4,9/2,
73 5,11/2,6,13/2,7,15/2,8,17/2,9,1/3,2/3,1,4/3,5/3,2,7/3,8/3,3,10/3,11/3,4,13/3,
74 14/3,5,16/3,17/3,1/4,1/2,3/4,1,5/4,3/2,7/4,2,9/4,5/2,11/4,3,13/4,7/2,15/4,4,
75 1/5,2/5,3/5,4/5,1,6/5,7/5,8/5,9/5,2,11/5,12/5,13/5,14/5,3,1/6,1/3,1/2,2/3,
76 5/6,1,7/6,4/3,3/2,5/3,11/6,2,13/6,7/3,1/7,2/7,3/7,4/7,5/7,6/7,1,8/7,9/7,10/7,
77 11/7,12/7,13/7,1/8,1/4,3/8,1/2,5/8,3/4,7/8,1,9/8,5/4,11/8,3/2,1/9,2/9,1/3,
78 4/9,5/9,2/3,7/9,8/9,1,10/9,11/9,1/10,1/5,3/10,2/5,1/2,3/5,7/10,4/5,9/10,1,
79 1/11,2/11,3/11,4/11,5/11,6/11,7/11,8/11,9/11,1/12,1/6,1/4,1/3,5/12,1/2,7/12,
80 2/3,1/13,2/13,3/13,4/13,5/13,6/13,7/13,1/14,1/7,3/14,2/7,5/14,3/7,1/15,2/15,
81 1/5,4/15,1/3,1/16,1/8,3/16,1/4,1/17,2/17,3/17,1/18,1/9,1/19]$
83 map (guess_exact_value, float (foolist));
86 /* still more examples */
88 guess_exact_value (float (%phi));
91 guess_exact_value (float (1/%phi));
94 guess_exact_value (float (zeta (2)));
97 guess_exact_value (float (zeta (4)));
105 (root: bfloat (sin (%pi/12)),
106 L: makelist (root^i, i, 0, 4),
107 m: pslq_integer_relation(%%));
108 [- 1, 0, 16, 0, - 16];
110 is (abs (m . L) < 10^(2 - fpprec));
113 guess_exact_value (0.0b0);
116 guess_exact_value (1.0b0);
119 guess_exact_value (bfloat (%pi));
122 guess_exact_value (bfloat (sin (%pi/12)));
125 guess_exact_value (bfloat (1/(1 + f(%e))));
128 guess_exact_value (bfloat ([1/sqrt(7), 11/sqrt(7), 19/sqrt(17)]));
129 [1/sqrt(7), 11/sqrt(7), 19/sqrt(17)];
131 guess_exact_value ([1.5b0, 2.75b0, 8.875b0, -1.5b0, -2.75b0, -8.875b0]);
132 [3/2, 11/4, 71/8, -3/2, -11/4, -71/8];
134 map (guess_exact_value, makelist (bfloat (k/10), k, 1, 9));
135 [1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10];
137 /* example from: https://arminstraub.com/downloads/math/pslq.pdf */
138 guess_exact_value (3.6502815398728847452b0);
139 sqrt(2*sqrt(10) + 7);
141 /* bug reported to mailing list: guess_exact_value(0.1) triggers division by zero */
142 guess_exact_value(0.1b0);
145 /* additional cases related to guess_exact_value(0.1) */
147 pslq_integer_relation ([1.0b0, 0.1b0, 0.010000000000000002b0, 0.0010000000000000002b0, 1.0000000000000002b-4]);
150 pslq_integer_relation (bfloat (makelist (1/10^k, k, 0, 4)));
153 pslq_integer_relation (makelist (0.1b0^k, k, 0, 4));
156 map (guess_exact_value, [0.125b0, 0.2b0, 0.25b0, bfloat(1/15), bfloat(1/17)]);
157 [1/8, 1/5, 1/4, 1/15, 1/17];
159 foolist: apply ('append, makelist (makelist (p/q, p, 1, 20 - q), q, 1, 19));
160 [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,1/2,1,3/2,2,5/2,3,7/2,4,9/2,
161 5,11/2,6,13/2,7,15/2,8,17/2,9,1/3,2/3,1,4/3,5/3,2,7/3,8/3,3,10/3,11/3,4,13/3,
162 14/3,5,16/3,17/3,1/4,1/2,3/4,1,5/4,3/2,7/4,2,9/4,5/2,11/4,3,13/4,7/2,15/4,4,
163 1/5,2/5,3/5,4/5,1,6/5,7/5,8/5,9/5,2,11/5,12/5,13/5,14/5,3,1/6,1/3,1/2,2/3,
164 5/6,1,7/6,4/3,3/2,5/3,11/6,2,13/6,7/3,1/7,2/7,3/7,4/7,5/7,6/7,1,8/7,9/7,10/7,
165 11/7,12/7,13/7,1/8,1/4,3/8,1/2,5/8,3/4,7/8,1,9/8,5/4,11/8,3/2,1/9,2/9,1/3,
166 4/9,5/9,2/3,7/9,8/9,1,10/9,11/9,1/10,1/5,3/10,2/5,1/2,3/5,7/10,4/5,9/10,1,
167 1/11,2/11,3/11,4/11,5/11,6/11,7/11,8/11,9/11,1/12,1/6,1/4,1/3,5/12,1/2,7/12,
168 2/3,1/13,2/13,3/13,4/13,5/13,6/13,7/13,1/14,1/7,3/14,2/7,5/14,3/7,1/15,2/15,
169 1/5,4/15,1/3,1/16,1/8,3/16,1/4,1/17,2/17,3/17,1/18,1/9,1/19]$
171 map (guess_exact_value, bfloat (foolist));
174 /* still more examples */
176 guess_exact_value (bfloat (%phi));
179 guess_exact_value (bfloat (1/%phi));
182 guess_exact_value (bfloat (zeta (2)));
185 guess_exact_value (bfloat (zeta (4)));