18

Introduction

I don't know if this question has already been asked (I didn't find it in the list of questions already asked) and I hope it won't be closed immediately since it's technically a question without context.

I wanted to know the name of the algorithm that is implemented on Wolfram to recognize numbers. In particular, I would need it to be able to obtain the coefficients of certain numbers.

Question

We start from the assumption that a good part of the results that Wolfram gives are absurd and that they contain constants that are not widely used. I wanted to know if there was a "simpler" algorithm that only involves an rational and a certain constant that is chosen a priori.

Example

If I have a number like $$48.816776471217042048816689916025967826926945218597900984114771090$$ and I know nothing about this number, only that it is the result of a polynomial with coefficients in $\mathbb{Q}$, calculated in $x=\pi$

What is the algorithm that tells me that this number is equal to $$3\pi^2+5\pi+\frac{7}{2}$$ ?

(In this case I only consider polynomials with coefficients in $\mathbb{Q}$.)

I used in the example of $\pi$ but I could also use $e$, $\sqrt{5}$, the Catalan constant, $\zeta(3.4)$, $\text{Si}(\sqrt{11})$ etc...

Motivation

Essentially because often I have numerical results of which I know the general form i.e.:

  • The irrational number in question in which the polynomial is calculated
  • The degree of the polynomial

But not the specific coefficients and Wolfram it does not calculate them because perhaps they are made up of numbers that are too high in the numerator or denominator, in case I would like it I would be the one to forcefully implement the algorithm

Application

  • Parameter-dependent integrals (series) in which we see that the result is a polynomial that depends on a parameter
  • Inversion of series (in these cases Wolfram is good at giving the numerical result of the n-th derivatives, but after a while he no longer gives the closed form)
Efesto
  • 1
  • 9
  • 2
    (1) http://mrob.com/pub/ries/index.html (2) https://wayback.cecm.sfu.ca/projects/ISC/ISCmain.html Something like these? – Math Attack Jan 19 '24 at 19:08
  • @MathAttack Almost, but it doesn't work the way I said. But thanks, now I know the name of the algorithm in general. I would like to understand how to implement my specific case in which the solution is not considered between millions of irrational numbers but only between one and the form must be a polynomial of degree fixed to rational coefficients. – Efesto Jan 19 '24 at 19:24
  • 1
    Possibly interesting: Chow, T.: What is a closed-form number. Am. Math. Monthly 106 (1999) (5) 440-448 – IV_ Jan 19 '24 at 21:05
  • 1
    Every polynomial passing through the point $(\pi,a)$ satisfies, in particular the simplest $y=\dfrac{a}{\pi}x$. Perhaps Wolfram uses some polynomials passing through $(\pi,a)$ from which the transcendent coefficients can be eliminated since his job is to rationalize the coefficients. What it is clear is that $a=48.81677647121......$ is a trascendental number as well as $\pi$ so the given $a$ is just an approximation of $3\pi^2+5\pi+3.5$ – Piquito Jan 19 '24 at 21:21
  • 1
    This thread may help (these examples used lindep in the free pari/gp ; for Mma see Number Recognition ). Concerning your example if a is your number lindep([a,1,Pi,Pi^2],20) returns [-2, 7, 10, 6]~ – Raymond Manzoni Jan 20 '24 at 21:58
  • 1
    In Mma FindIntegerNullVector[{a,1,Pi,Pi^2},20] returns {-2, 7, 10, 6} – Raymond Manzoni Jan 20 '24 at 22:20
  • 3
    Wikipedia's Integer relation algorithm should provide references to the algorithms used. PSLQ for example is a generalization of the continued fraction algorithm (with the floor at each step replaced by the round function). – Raymond Manzoni Jan 20 '24 at 23:15
  • In 2000 the PSLQ algorithm was selected as one of the "Top Ten Algorithms of the Century", https://web.archive.org/web/20210424004030/https://www.uta.edu/faculty/rcli/TopTen/topten.pdf – Gerry Myerson Jan 27 '24 at 09:43

1 Answers1

2

I suggest an optimization-based method to solve your example. A simiar method can be used to find rational coefficients when you are intrested in a possibly long list of specific numbers such as $e^i, \pi^i, e^i\pi^j, i,j=1,2,\dots$, etc.

For the given number $B$ in your example, we want to find rational numbers $a_0, a_1, a_2, \dots$ such that

$$a_0+a_1\pi+a_2\pi^2+\dots =B.$$

Then, you can solve the following optimization problem:

$$\min \left|\sum_{i=0}^{N}\pi^ix_i-yB\right| \\ \text{subject to}: x_i \in \{-K, -(K-1),\dots,0,\dots, K-1,K\},i=1,\dots,n,\\y\in \{1,\dots, K-1,K\}.$$

Here, $K$ and $N$ are sufficiently large integers, which can be set based on $B$.

This can be rewritten as the following mixed-integer linear programming (MILP) model:

$$ \min z \\ -z \le \sum_{i=0}^N \pi^ix_i-yB \le z \\ -K \le x_i \le K, i=0,\dots,N \\ y \ge 1 \\ y, x_i \in \mathbb Z, i=0,\dots,N \\ z \in \mathbb {R}_{+}.$$

If the optimal value $z^*=0$, then the desired numbers are

$$a_i=\frac{x^*_i}{y^*}, i=0,\dots, N.$$

If the optimal value $z^*>0$, then we have two cases either there is no closed form in terms of $\pi^i, i=0,\dots, N$, or $K$ and $N$ are not set appropriately.

MILP models can be solved in large scales by commercial optimization solvers such as Cplex. You can also use Pyomo library of Python, Solver Add-in of MS Excel, or other tools.

Amir
  • 4,305
  • I am not familiar with the state of the art in general integer program solvers, but I would be (pleasantly) shocked if, for instance, one could find that $|2851718461558\pi - 8958937768937|$ is close to $0$ with any degree of efficiency, whereas PSLQ and its ilk are specialized for this type of question. – Erick Wong Jan 20 '24 at 22:21
  • @ErickWong Thanks for your comment! It is a somehow different method that I could suggest, which may be interesting for readers. I agree with you on that specialized tools use efficient methods. However, I am not sure that MILP solvers fail to solve such problems since they can solve complex problems with hundred thousands of variables and constraints. – Amir Jan 20 '24 at 23:03
  • Addressing your concern, to have more computational stability, the above model need to be used step by step. As the coefficients are all integers, we have some stability for the optimal solution. So, instead of $B$, we can first consider a shorter number with a limited number of its first decimals. If the optimal value is small, we can check the optimal solution with the orginal number, and if it is not sufficiently enough, we can add more decimals, and stop otherwise. Indeed more details are required in the implementation phase, which may help to improve computational efficiency. – Amir Jan 20 '24 at 23:04