AskConstants is an application that I implemented in Mathematica, freely downloadable from math.hawaii.edu/~dale/AskConstants/AskConstants.html or AskConstants.org. The main purpose is for you to enter a floating-point number, for which the application returns zero or more candidate exact constant expressions that have a useful chance of being the limit of your float as the number of correctly-rounded significant digits increases. This article shows some examples and explains the methods that are used to accomplish this seemingly magical feat.
ABSTRACT (original article): There are now several comprehensive web applications, stand-alone computer programs and computer algebra functions that, given a floating point number such as , can return concise nonfloat constants such as , that closely approximate the float. This is analogous to unscrambling an egg. Such software includes AskConstants, Inverse Symbolic Calculator, the Maple identify function, MESearch, OEIS, Ordner, RIES, and WolframAlpha. Usefully often such a result is the exact limit as the float is computed with increasing precision. Therefore these program results are candidates for proving an exact result that you could not derive or conjecture without the program. Moreover, candidates that are not the exact limit can be provable bounds, or convey qualitative insight, or suggest series that they truncate, or provide sufficiently close efficient approximations for subsequent computation. This article describes some of these programs, how they work, and how best to use each of them. Almost everyone who uses or should use mathematical software can benefit from acquaintance with several such programs, because these programs differ in the sets of constants that they can return. CITATION (original article): David R. Stoutemyer (2023), “How to hunt wild constants”, Maple Transactions, 3(1). https://doi.org/10.5206/mt.v3i1.14661
6.518670730718491
3arctan2+ln9+1
Introduction
Introduction
This article is an adaptation of Section 8.1 from the above-mentioned original article.
For brevity, floating-point numbers are called floats in this article.
◼
Usefully often there are usefully concise explicit exact closed-form solutions that are not obtainable by functions such as Solve, Integrate, or Sum, but Mathematica can at least provide float approximations by corresponding functions such as FindRoot, NIntegrate, or NSum.
◼
The AskConstants application was developed to convert such resulting floats into nonfloat constants that are usefully likely to be the exact result that you you seek. Using Mathematica 12.1, here is an example from Bill Gosper:
In[]:=
Product-,{n,1,∞}
πArcTan[n]
2ArcTan[1-2n]ArcTan[2n]
Out[]=
∞
∏
n=1
πArcTan[n]
2ArcTan[1-2n]ArcTan[2n]
However, AskConstants proposes the remarkably concise candidate for the float value 1.5546822754821 returned by
1/π
4
NProduct-,{n,1,∞},WorkingPrecision19
πArcTan[n]
2ArcTan[1-2n]ArcTan[2n]
◼
As with unscrambling an egg, such “constant recognition” software appears to violate the second law of thermodynamics. However, it works often enough so that that knowing about such software can be useful for anyone who cannot determine an explicit exact closed-form but would prefer one to a float that they can determine.
◼
Candidates that are relatively very close but not equal to the exact limit you seek are called impostors. Some are unintended coincidences, but impostors are often intentionally constructed by recreational mathematicians to be that way, with concise expressions that are very close to integers or to well-known constants such as π or .
◼
Returned candidate expressions are not guaranteed to be the limit you seek. However, you can increase the likelihood toward 1.0 by increasing the number of correctly rounded digits in your float input by generous increments until you become impatient computing them or sufficiently convinced whether or not the candidate is the limit you seek. If the magnitude of the difference between your float and the candidate stops decreasing toward 0.0 or that candidate disappears, then the candidate is almost certainly an impostor.
The Propose function
The Propose function
Floats typically arise from endeavors such as the Mathematica function invocations
In[]:=
SolveEllipticK[x]22+,x
2
Gamma-
1
4
2
3/2
π
Out[]=
xRootEllipticK[#1]--&,0.0294372515228594143797353094836
4
3/2
π
2
Gamma-
1
4
2
2
3/2
π
2
Gamma-
1
4
In[]:=
ReduceEllipticK[x]22+,x
2
Gamma-
1
4
2
3/2
π
Out[]=
ReduceEllipticK[x]2(2+,x
2
Gamma-
1
4
2
)3/2
π
Although neither the Solve nor Reduce function determined an explicit exact closed-form solution, the Solve function did return an implicit solution containing an approximate float solution to indicate which solution is being returned. However there might be an explicit exact closed-form solution that the Solve function could not determine. After downloading, installing, then loading the AskConstants application into a Mathematica session, to determine if the AskConstants application can propose likely such candidates, you can later copy the complete float 0.0294372515228594143797353094836 from the above result of Solve, then Paste that entire float into the following input and execute it::
In[]:=
Propose[0.0294372515228594143797353094836230571639374954766231218799`30.]
Out[]=
{ModularLambda[2],Excellent Agreement≃45.,Entropy10≃2.90103,Excellent Margin≃42.099},,Excellent Agreement≃45.,Entropy10≃3.60309,Excellent Margin≃41.3969,,Excellent Agreement≃45.,Entropy10≃3.60309,Excellent Margin≃41.3969,,Excellent Agreement≃45.,Entropy10≃3.82918,Excellent Margin≃41.1708,,Excellent Agreement≃45.,Entropy10≃3.82918,Excellent Margin≃41.1708
4
(-1+
2
)1
4
(1+
2
)2
(3-2
2
)2
(-3+2
2
)Notice that the Paste revealed hidden guard digits that are not ordinarily displayed. These extra guard digits help Propose identify promising candidates. Thus if your float comes from a Mathematica notebook, then it is better to copy all of the float then paste rather than copying only some of the float or typing all of the original displayed float.
The Propose function returns a set of zero or more equivalence sets.
◼
This Propose result contains only one equivalence set.
◼
Each equivalence set contains one or more lists consisting of a nonfloat candidate followed by three labeled assessment metrics described below.
◼
PossibleZeroQ-
candidate
j
candidate
k
◼
For float != 0.0,
|
◼
Based on information theory, Entropy10 [candidate] is a measure of nonfloat expression complexity that is the sum of the base-ten logarithms of the absolute values of all the nonzero integers occurring in numerators and denominators of rational numbers, plus an average of about 1.0 per explicit or implicit occurrence of a operator, named constant or function name – less for common published ones such “+“ and π, or more for infrequently published ones such as ModularLambda.
◼
It is desirable to have high agreement, but it is also desirable to have low expression complexity because floats can be approximated arbitrarily well by sufficiently complicated nonfloats that are impostors rather than the limit you seek. For example, all floats can be represented exactly as rational numbers. Therefore we want candidates that have not only large Agreements, but also large
|
◼
The elements of an equivalence set are sorted by nonincreasing order of their Margins, with ties broken by nonincreasing order of their Agreements.
◼
The equivalence sets are sorted by nonincreasing order of the Margins of their first elements, with ties broken by nonincreasing order of the Agreements of their first elements.
◼
Thus the most highly rated of the above Propose candidates is because the candidate Agreements were all the same but its Entropy10 was least because of its very concise argument, making its Margin greatest. I personally prefer the alternative , but no one complexity measure pleases even the implementer all of the time.
ModularLambda[2]
4
(-1+
2
)◼
As illustrated in the yellow mouse-over tooltip at the beginning of this article, I use the qualitative likelihood phrases Excellent, Good, Medium, Poor, Bad, and Terrible to characterize the estimated likelihood of candidates being the limit you seek.
ProposeMonitor [ ]
ProposeMonitor [ ]
If we next type then execute
In[]:=
ProposeMonitor[];
then it opens the following monitor window that contains additional information.
If we had opened a monitor window before executing the Propose example input, then we would have seen up through the four best candidate entry rows as they were computed, including candidates that do not meet the final acceptance criteria. This helps entertain you as you await the final result, which can require 5 or more minutes on most personal computers if you include the nondefault option . Moreover, you can press the [Quit soon] button in the monitor window as soon as you see an acceptable result
SlowTables→Large
The Propose wizard
The Propose wizard
Propose has optional arguments for table selection and other purposes, and entering Propose [ ] without any arguments invokes a wizard that helps you choose optional arguments appropriately for patience, experience, expectations, and the amount of available Random Access Memory. For example:
In[]:=
Propose[];
opens the wizard Window
For example, if you press the button [2] near the top of this window for the second instructive example, it will insert the expression
|
in the window’s input field and adjust the Methods selections to be appropriate and fast for this example. If you then press the [Copy] button, you can then paste the entire following input then execute it, giving
In[]:=
ProposeFindRoot--5+4+3x.1,x.,0.27`,WorkingPrecision241,2,{FastTablesNone,SlowTablesNone,IRModelsAll}
1
5
x.
4
x.
3
x.
2
x.
Out[]=
Root[-1+3#1+4-5-+&,3],Excellent Agreement≃25.2473,Entropy10≃8.76261,Excellent Margin≃16.4847,+2Re1202-65+2Re-,Excellent Agreement≃25.2473,Entropy10≃54.5379,Terrible Margin≃-29.2906
2
#1
3
#1
4
#1
5
#1
1
5
1
5
1/5
1
2
5
-15401(5-2
5
)1
5
1/5
-
1
2
1/5
1202+65
5
-15401(5+2
5
)The Propose function identified the first alternative in the equivalence set, then used the amazing compact heuristic degree 5, 6 and 7 exact polynomial solver implemented by Bill Gosper and Julian Zeigler Hunts to derive the other alternative. (Extractable source code for that solver is included in the AskConstants Propose.m package.)
The ProposeBestOrInput function
The ProposeBestOrInput function
opens the wizard window
Notice that ProposeBestOrInput did not determine a nonfloat candidate for the random float in the input. This is almost certainly appropriate because random floats having significands of more than a very few digits rarely model nonfloats having an acceptable Agreement and Margin.
The AskConstants GUI interface to the Propose function
The AskConstants GUI interface to the Propose function
Figure 1 at the beginning of this article shows the use of AskConstants Graphical User Interface to propose a closed form for the definite integral
that Mathematica through at least version 12.1 cannot determine in exact closed form. (Thank you Danny Lichtblau for that example.)
That example is one of several instructive examples from the drop-down menu on the button left of the input field. That example was entered as a one-dimensional string to prevent the input from being replaced immediately by the corresponding float upon pressing [Enter], before I could could do window capture showing the problem source and result in a single image. It is more typical to compute the float separately in a notebook, then copy and paste it into the input field.
Here is such an example, adapted from the article “Inverse spherical Bessel functions generalize Lambert W and solve similar equations containing trigonometric or hyperbolic subexpressions or their inverses” at https://mapletransactions.org/index.php/maple/article/view/16787 :
Professor Dottie noticed that whenever she typed any float into her calculator in radian mode then repeatedly pressed the cosine button, thus computing
where 0.7 is an initial guess or from
Out[]=
0.739085
No explicit exact closed form representation was known for this float Dottie number from approximately 1865 to 2022.
To see if AskConstants can propose an , we can copy that float, then invoke the Graphical User Interface by entering then executing
then paste the float into the input field of the resulting window, then press the Enter key, giving (Click the image for a higher resolution version)
AskConstants displays accepted candidates in the left side of the Result sub-tab and displays an associated scatter plot of Agreement versus Entropy10 in the right side, where:
◼
The scatter plot shows the Agreement versus Entropy10 for the most likely candidates as a dots, with large dots for the candidates displayed on the left pane and small dots for some less likely candidates for comparison.
◼
As illustrated, hovering your mouse over a dot invokes a tooltip giving the candidate expression, its Agreement, Entropy10, and Margin.
◼
The background color behind each dot is the qualitative assessments for the likelihood of the candidate being the limit you seek:
◼
The upper horizontal dashed line is the Precision of the input float estimated by Mathematica’s arbitrary-precision significance arithmetic – or 15.95 for machine floats.
◼
The lower horizontal dashed line is the smallest acceptable Agreement for the Precision of the given float.
◼
The dashed diagonal line is the smallest acceptable Margin.
◼
The Propose tab at the top left of of Figure 2 has sub-tabs displayed below the blue input pane.
◼
The Math paste buttons sub-tab helps you know which functions AskConstants can include in candidates and helps you enter them correctly in the Input field. For example, here is one of its special function sets: (Click the image for higher resolution version)
◼
The Monitor sub-tab is similar to the Propose monitor described in a previous subsection.
Methods used by the Propose function
Methods used by the Propose function
More detail is provided in the Summary section of the Propose.m file of the zipped AskConstants download from math.hawaii.edu/~dale/AskConstants/AskConstants.html or AskConstants.org, but to summarize that Summary:
Search tables
Search tables
Unidirectional binary search
Unidirectional binary search
One method that can be used to propose candidate expressions is make a table in which each row contains a machine-float value and a corresponding exact constant expression. With the rows sorted by values of the floats, binary search can then be used to bracket the input float in an interval defined by the floats in two adjacent rows.
AskConstants optionally uses a large forward table or else a small forward table that is more suitable for computers that have less than about 3 gigabytes of available Random Access Memory, such as my Raspberry Pi, which has only 1/2 megabyte.
However, those tables would be impractically large to represent a useful percent of expressions that typically occur in many books and articles. Fortunately there are ways to reduce total table space needed to model a usefully large number of expressions:
Bidirectional repeated binary search
Bidirectional repeated binary search
Bidirectional colinear search
Bidirectional colinear search
As with merging two sorted lists, the idea is to keep indices into both lists that start at their largest indices, then repeatedly decrement toward index 0 whichever index points to the larger of these two floats, accumulating candidates for which the Agreement and Margin of float with its candidate are acceptable.
The Propose function and other AskConstants functions that use it offer the user a choice of None, Small or Large for the option FastTables and the same choice for the option SlowTables. The Fast tables use bidirectional repeated binary search with a very small backward table having only about 16,000 rows and a Small forward table having about 2.4 million rows or a Large forward table having about 15 million rows. The Slow tables use one of those forward tables together with a backward table having about 700,000 rows.
Sign and significand aliasing
Sign and significand aliasing
Each pair of one choice from a forward table and one from a backward table thus models a countably infinite number of hydrated candidate expressions. However, the minimum required number of correctly rounded input significand digits increases as the Entropy10 of the hydration factor ±(2^n) increases with n.
Integer relations models
Integer relations models
◼
Another way to exploit this algorithm is if
then a linear fractional candidate with integer coefficients is
or else to return the input to indicate that RootApproximant could not determine such an algebraic number. (Challenge: describe how FindIntegerRelation can be used to accomplish this.)
The Propose function uses about 3000 different integer relation models.
Summary
Summary
◼
My original objective for implementing the AskConstants package was to make a tool for helping simplify mathematical expressions that contain floats, as described in “Fuzzy simplification of non-numeric expressions containing some intervals and/or floating point numbers”:
◼
At that time I did not have any particular float that I hoped to identify. However, while collecting examples for my test suite, I have discovered a surprising number of explicit exact closed-form constants for which only float approximations were previously published.
◼
I hope that AskConstants can find some for you too.
◼
And for examples where it cannot, at least you then have the peace of mind that there probably was not some very simple exact result that you overlooked.
◼
I would value learning about your most amazing identifications and disappointments to help improve AskConstants.
◼
My contact information is in the Contacts tab of the AskConstants window, and there is a Questionnaire tab for suggestions.
References (in order of first appearance)
References (in order of first appearance)
[1] Stoutemyer, D. R., “How to hunt wild constants”, https://mapletransactions.org/index.php/maple/article/view/14661
https://doi.org/10.5206/mt.v3i1.14661
https://doi.org/10.5206/mt.v3i1.14661
[3] Stoutemyer, D. R., “Inverse spherical Bessel functions generalize Lambert W and solve similar equations containing trigonometric or hyperbolic subexpressions or their inverses”, Maple Transactions, 4(2), (2024). https://doi.org/10.5206/mt.v4i2.16787
[4] Stoutemyer, D. R., “Fuzzy simplification of non-numeric expressions containing some intervals and/or floating point numbers”, https://dl.acm.org/doi/proceedings/10.1145/2608628
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
The AskConstants application for constant recognition
by David Stoutemyer
Wolfram Community, STAFF PICKS, March 26, 2024
https://community.wolfram.com/groups/-/m/t/3148139
by David Stoutemyer
Wolfram Community, STAFF PICKS, March 26, 2024
https://community.wolfram.com/groups/-/m/t/3148139
