Search for a formula that yields a given number.
searches for equivalents to the given number y from common mathematical functions.
returns up to n results for the number y.
searches for a formula with the given functional form
returns up to n results.
searches for a formula for the given number
returns up to n results.
Before starting any search, FindClosedForm[y,n] queries Wolfram Alpha for possible closed forms of the given number. If this query does not return the required number of results with sufficient precision, the main search algorithm begins.
The fundamental strategy exploited by the search algorithm of
When only the first argument
The second argument can be a mathematical function
In some cases, more than one valid formula can be found. The desired number of results must be specified as a second or third argument.
Notice that the search may take a very long time. If multiple results are requested but only partial results are found, they are printed temporarily to let the user know. If the user decides to abort the search, the earlier results are kept and returned safely.
FindClosedForm accepts the following options:
The value for the option "SignificantDigits" is set automatically to the number of digits (before 0) specified in the given number
The value for the option "FormulaComplexity", for any closed form formula, is a positive real which can be custom set or computed as follows: i) take all integers appearing in the formula, possibly being part of rational, algebraic or complex numbers; ii) if a root appears, duplicate its argument a number of times equal to the root degree; iii) for each integer, compute the mean among the square root of its absolute value, its DigitSum and 5 times its IntegerLength; iv) take the total of these means.
The option "WolframAlphaQueries" sets the number of queries to be tried directly on Wolfram Alpha. Notice these can be unsuccessful, because the result of each query: i) may be not precise enough (as determined by "SignificantDigits"); ii) may be too complex (as determined by "FormulaComplexity"); iii) or may not have a corresponding Wolfram Language formula representation.
The option "SearchQueries" determines the number of results to be searched through the main search algorithm of FindClosedForm. When the default Automatic is used, it is taken to be the difference between number of results required, n, and the number of successful results returned by Wolfram|Alpha. Otherwise it is possible to set its value to 0, to make
If the options "AlgebraicAdd" or "AlgebraicFactor" are set to True, the numerical match is searched up to addition or multiplication by algebraic numbers, respectively.
If the option "RootApproximantMethod" is set to "BuiltIn", these algebraic numbers are all those found through the built-in functions RootApproximant and ToRadicals. If instead the option "RootApproximantMethod" is set to Automatic, the algebraic numbers are assumed to have one of the absolute values equal to a "small" integer, fraction or fraction root. The complex phase of algebraic numbers is assumed to be within a π -multiple of a "small" fraction. It is also possible to specify the value for the option "RootApproximantMethod" as custom table of possible absolute values, or as a list of an absolute value table and complex phase table.
Summarizing, the possible values for the option "RootApproximantMethod" are the following:
If the option "RationalSolutions" is set to True, simple rational solutions are allowed. These are typically trivial, so unless the function searched for is the Identity, or both "AlgebraicAdd" or "AlgebraicFactor" are set to False, the default value for this option is False and thus no simple rational can be returned.
If the option "SearchArguments" is set to Automatic, the algorithm automatically tries arguments within an increasingly larger range each, with a cutoff equal to the search round (or function of it). Notice that argument ranges at successive rounds do overlap, but the program does not recompute the previously tried arguments combinations. In particular, special values for the option "SearchRange", as functions of the search round, are the following:
Arguments to be tried can be specified through the option "SearchArguments" as a List - if there is only one Slot - or as a list of lists - one for each slot - or as an Association between slots and lists, as keys and values respectively, as follows:
The default output of "OutputArguments" set to True, also the arguments can be returned in the output, as keys of an association with the corresponding closed forms.
If the option "SearchComplex" is set to True, the search range, for each round, is the complex numbers extension of the ranges determined by the option "SearchRange", as realized through
The value for the option "MaxSearchRounds" sets the number of search rounds to be tried before terminating the program. Similarly the maximum time spent by the search algorithm can be set through the option "SearchTimeLimit". If the search terminates with no closed form is found, the output of FindClosedForm is None.
Find a possible mathematical function for a number:
FindClosedForm[0.405465]Find possible closed form for a number in terms of common mathematical functions:
FindClosedForm[3.792277]Find formulae in terms of mathematical constants:
FindClosedForm[3.311601]FindClosedForm[1.044866]Specify the functional form of a formula in the second argument as a pure function:
FindClosedForm[1.85653, 1/Zeta[#]^2 &]FindClosedForm[-0.309033, PolyLog[#1, #2] &]Get four results:
FindClosedForm[3.3116, 4]The results are all approximately equivalent:
N[%]{3.31163, 3.31153, 3.31156, 3.31181}
Differing results of FindClosedForm can turn out to be strictly equivalent:
FindClosedForm[0.69314718, 4]FullSimplify@Apply[Equal, %]True
Get ten results based on Log:
FindClosedForm[0.405465, Log, 10]
N[%]{0.405465, 0.405465, 0.405465, 0.405463, 0.405463, 0.405467, 0.405468, 0.405462, 0.405462, 0.405469}
The numerical match with the functional form is searched up to addition or multiplication by an algebraic number (that is, a Root or Rational):
FindClosedForm[-1.185732, PolyGamma[#] &]FindClosedForm[0.780653, ArcSinh]The arguments can also be roots:
FindClosedForm[1.054136, BarnesG[Sqrt[2] #] &]Specify the form of any function combination, with a number of arguments:
FindClosedForm[7.443967, Log[1 + Exp[#]] &]10 Log[1 + Exp[1/10]]
FindClosedForm[4.688231, Gamma[#1]/Gamma[#2]&]FindClosedForm[0.7299085, HypergeometricU[#1, #2, #3] &]Search through a list of functional forms:
FindClosedForm[5.550045, {Sinh, Cosh, Sech, Csch}]FindClosedForm[-1.479735, {EllipticK[#] &, EllipticE[#] &, EllipticPi[#1, #2] &}]See many other examples and the rest of the documentation for all the options, applications, properties and relations at this page on the Wolfram Function Repository.