# How to extract a possible closed form from WolframAlpha[] output

To find a possible closed form of a number, I can use the function

WolframAlpha["6.38905609893065", IncludePods -> "PossibleClosedForm"]


It returns a result in the following form:

The InputForm of this result displays quite a large expression containing pods and cells represented as XMLElements.

Is there an easy way to extract the first suggested closed form as a normal expression (in this case, E^2 - 1)?

-
is this "easy"? WolframAlpha[ "6.38905609893065", {{"PossibleClosedForm", 1}, "FormulaData"}][[1, 1]] – chuy Oct 31 '13 at 21:03

## 1 Answer

Here is how you attack this: First click on the little "+" in the right upper corner. Then you select either "Subpod content" or directly "Formula data". Both will result in a more specific request which gives you the hint you need:

{WolframAlpha[
"6.38905609893065", {{"PossibleClosedForm", 1}, "FormulaData"}],
WolframAlpha[
"6.38905609893065", {{"PossibleClosedForm", 2}, "FormulaData"}],
WolframAlpha[
"6.38905609893065", {{"PossibleClosedForm", 3}, "FormulaData"}]}


From this, it is only one step to

WolframAlpha[
"6.38905609893065", {{"PossibleClosedForm", 1}, "FormulaData"}] /.
Hold[expr_ ≈ _] :> expr


-
Thanks, this was very useful. Unfortunately, it does not handle cases like 9.4536360064616926. In this case WolframAlpha returns $\frac{L^4}5$ with a comment that $L$ is the lemniscate constant. The FormulaData in this case is \$Failed, while ideally it would be Gamma[1/4]^8/(320 π^2). – Vladimir Reshetnikov Nov 1 '13 at 0:34
@VladimirReshetnikov Yes, this is very unfortunate, although I kind of expected that this does not work for every possible example. WolframAlpha is more a tool for a human user. – halirutan Nov 1 '13 at 14:30