I want to know is there any function in Mathematica that suggests a simple irrational number combination for decimal one?

For example, if I give 0.804738 then I get (Sqrt[2] + 1)/3.


Or consider 1.301290284568573 = π/(Sqrt[2] + 1).

It seems for the first example RootApproximant gives the correct answer but for the second its answer is not useful at all.

  • 1
    $\begingroup$ Have you seen RootApproximant? $\endgroup$
    – Michael E2
    Apr 10, 2021 at 2:31
  • $\begingroup$ Thank you! This works for this number. But I suggest that, for example, 0.8185261683292934 should be related to sqrt[2] with simple relation. $\endgroup$ Apr 10, 2021 at 2:36
  • $\begingroup$ I want a function that also predicts something like \pi, RootApproximant[[Pi]] is not that. $\endgroup$ Apr 10, 2021 at 3:30
  • $\begingroup$ Pi*RootApproximant[1.30129028/Pi] $\endgroup$
    – Bob Hanlon
    Apr 10, 2021 at 4:43
  • 4
    $\begingroup$ AskConstants is pretty amazing for this task. $\endgroup$
    – Roman
    Apr 10, 2021 at 6:56

2 Answers 2


Try WolframAlpha

guess[x_]:=WolframAlpha["identify "<>ToString@x]

enter image description here

enter image description here

  • 1
    $\begingroup$ There's no need for coding here: you can get the same effect by pressing "=" twice and entering the number (or any W$\alpha$ query) directly. $\endgroup$
    – Roman
    Apr 10, 2021 at 8:12
  • $\begingroup$ Thank you. Yes, it works. $\endgroup$ Apr 11, 2021 at 1:56

AskConstants is extremely powerful. For the second example it gives several results:

(-1 + Sqrt[2]) \[Pi]
\[Pi] Tanh[ArcCosh[3]/4]
\[Pi] Sqrt[ModularLambda[I Sqrt[2]]]
(1 + Sqrt[2]) \[Pi] Sqrt[ModularLambda[2 I]]
1/2 \[Pi] Tanh[ArcCoth[2 + Sqrt[2]] + ArcCsch[1]]

enter image description here

  • $\begingroup$ While this package might be powerful, it is huge (!) and strangely organized. I read ` INSTALL.nb` and ` LOAD_ASKCONSTANTS.nb` twice, and still could not figure out how to install this thing. $\endgroup$
    – yarchik
    Apr 11, 2021 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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