Here's some code that I used recently, based on code by Paul Abbott [1, 2].
Clear[TranscendentalRecognize]
TranscendentalRecognize[num_Real, basis_List, ord_?Positive, debug:(True|False):False] :=
Module[{vect, mat, lr, ans},
vect = Round[10^Floor[ord - 1] Join[{num}, N[basis, ord]]];
mat = Append[IdentityMatrix[Length[vect]], vect];
lr = LatticeReduce[Transpose[mat]];
If[debug, Print[lr // TableForm]];
(* If a row of lr starts with zero, then it's just a relationship between the basis
element. We move such rows to the end. *)
While[lr[[1, 1]] === 0, lr = RotateLeft[lr]];
(* Now that the first element of the first row is nonzero, we choose it as our best
solution and normalize the answer *)
ans = First[lr[[1]]]^-1 Most[Rest[lr[[1]]]].basis;
Sign[N@ans] Sign[num] ans]
TranscendentalRecognize[num_Real, basis_List] :=
TranscendentalRecognize[num, basis, Precision[num]]
Then, we can identify your number using something like
num = Sum[1/(2`50*n!), {n, 0, 100}]
TranscendentalRecognize[num, {E, Pi, EulerGamma}]
(* Returns
1.3591409142295226176801437356763312488786235468500
E/2 *)
Compare with
WolframAlpha[ToString[num], IncludePods -> "PossibleClosedForm"]
This code can be cleaned up a little and made more efficient by using the PSLQ based algorithm FindIntegerNullVector
introduced in Mathematica version 8.
This is probably something like that which Wolfram|Alpha does. It just tries a combination of various common transcendentals until it comes up with something that looks close.
To see some code on how you might write something like that, look at the mpmath (Python) implementation - Number Identification.
For example, here's a quick IPython session:
In [1]: from mpmath import *
In [2]: mp.dps = 20;
In [3]: identify(1.35914091422952261768014, ['e', 'pi'])
Out[3]: '((1/2)*e)'
Limit
function. $\endgroup$Sum
if you want to get the limit of a sum like the one I showed. $\endgroup$