Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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:

Possible closed forms

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)?

share|improve this question
2  
is this "easy"? WolframAlpha[ "6.38905609893065", {{"PossibleClosedForm", 1}, "FormulaData"}][[1, 1]] –  chuy Oct 31 '13 at 21:03
add comment

1 Answer 1

up vote 4 down vote accepted

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

Mathematica graphics

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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