3
$\begingroup$

Suppose, $u$ is the unique real solution of $x^x=\pi$ and $v$ is the unique real solution of $x\cdot e^x=\pi$

Expressed with the Lambert-w-function we have $u=e^{W(\ln(\pi))}$ and $v=W(\pi)$

Wolfram gives the following very good approximations

$$u\approx \frac{1256-84\pi-5\pi^2}{-232-157\pi+125\pi^2}$$

with an absolute error of less than $2\cdot 10^{-18}$

and $$v\approx \frac{125-211\pi+235\pi^2}{-712-461\pi+387\pi^2}$$

with an absolute error of less than $2\cdot 10^{-19}$

  • How can I calculate such approximations ?

The approximations look like Pade-approximations. PARI/GP can calculate such Pade-approximations, but I only managed to do it for functions and not for real numbers.

The object is obviously to find a rational function $f(x)$, such that for a given constant $s$, $f(s)$ is the best approximation of a given number (given some limit to the degrees of the polynomials).

With the bestappr-function, PARI could then find a function $g(x)$ such that for a given limit of the absolute value of the coefficients, $g(x)$ is the best approximation of $f(x)$.

But how can I get the function $f(x)$ ?

$\endgroup$
  • 1
    $\begingroup$ Are you asking about how to get a rational approximation to a function? The expressions you cite seem notable for their integer coefficients, which suggests they are the result of lattice approximations. $\endgroup$ – hardmath Sep 28 '16 at 12:24
2
$\begingroup$

I think that Alpha uses an integer relation algorithm (PSLQ or LLL) implemented too in pari/gp.

The trick here is to use the pari/gp command lindep with a precision of $18$ digits (forced by alpha I think) :

> u= solve(x=1,2, x^x-Pi)
= 1.8541059679210264327483707184102932454 
> lindep([1,Pi,Pi^2, u,u*Pi,u*Pi^2], 18)
= [-1256, 84, 5, -232, -157, 125]~

this means that $-1256+84\pi+5\pi^2-232\,u-157\,u\,\pi+125\,u\,\pi^2\approx 0\;$ or that $$u\approx\frac{1256-84\pi-5\pi^2}{-232 -157\pi+125\pi^2}$$ Change the value $18$ in lindep (and the precision of $u$) if more precise results are wished (or add higher powers of $\pi$ and so on...)

$\endgroup$
  • $\begingroup$ A superb answer! Thank you very much! $\endgroup$ – Peter Sep 28 '16 at 11:58
  • $\begingroup$ Glad you liked it @Peter! For other examples of the same kind see for example this thread. $\endgroup$ – Raymond Manzoni Sep 28 '16 at 12:00
  • $\begingroup$ I thought about the lindep-command, but I did not have the idea to add the numbers $u,u\pi,u\pi^2,\cdots$ and that this actually leads to a rational approximation. $\endgroup$ – Peter Sep 28 '16 at 12:02
1
$\begingroup$

An interesting read on how Wolfram (and other programs) might find such approximations can be found here, the same website also offers the source to a program that can find approximations to numbers you input.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.