Re: Mathematica is not very clever
- To: mathgroup at smc.vnet.net
- Subject: [mg53477] Re: Mathematica is not very clever
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Thu, 13 Jan 2005 03:59:49 -0500 (EST)
- Organization: The University of Western Australia
- References: <cq6e2v$2po$1@smc.vnet.net> <cs5aj7$3pb$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <cs5aj7$3pb$1 at smc.vnet.net>, "Astanoff" <astanoff at yahoo.fr> wrote: > Klaus G wrote: > > Mathematica refuses to compute the following integral: > > > > Integrate [ArcTan[Sqrt[x^2 + 2]]/((x^2 + 1)*Sqrt[x^2 + 2]), {x, 0, > 1}] > > > > Why is that? > > The correct result is 5*Pi^2 / 96, which can be proved. > > > > Klaus G. > > I wonder why mathematica doesn't provide an engine > (like Plouffe's inverter) to convert a floating-point value > into an exact value... In The Mathematica Journal 6(2): 29-30, you will find code for TranscendentalRecognize[] that rationalizes the given transcendental basis and then uses rational arithmetic and LatticeReduce to find the "simplest" (rational) representation for the floating point number in that basis: TranscendentalRecognize[n_, basis_] := Module[{c, d, digs, e, id, lat, powerten, r, s, vals}, {d, e} = RealDigits[n]; s = Sign[n]; c = FromDigits[d]; powerten = 10^(Length[d] - e); digs = (RealDigits[N[#1, -e + Length[d] + 5]] & ) /@ basis; r = (FromDigits[Take[First[#1], -e + Last[#1] + Length[d]]] & ) /@ digs; lat = Transpose[Append[IdentityMatrix[Length[basis] + 2], Flatten[{powerten, r, c}]]]; vals = Take[First[LatticeReduce[lat]], Length[basis] + 2]; Expand[-((s (Take[vals, {2, -2}] . basis + First[vals]))/Last[vals])] ] This code works fine on the example above: num = NIntegrate[ArcTan[Sqrt[x^2 + 2]]/((x^2 + 1) Sqrt[x^2 + 2]), {x, 0, 1}, WorkingPrecision -> 30]; TranscendentalRecognize[num, {1/Pi, Pi, Pi^2, E, Log[2]}] (5 Pi^2)/96 Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul
- Follow-Ups:
- Re: Re: Mathematica is not very clever
- From: DrBob <drbob@bigfoot.com>
- Re: Re: Mathematica is not very clever