[Date Index]
[Thread Index]
[Author Index]
Re: Re: Mathematica is not very clever
*To*: mathgroup at smc.vnet.net
*Subject*: [mg53491] Re: [mg53477] Re: Mathematica is not very clever
*From*: DrBob <drbob at bigfoot.com>
*Date*: Fri, 14 Jan 2005 08:54:40 -0500 (EST)
*References*: <cq6e2v$2po$1@smc.vnet.net> <cs5aj7$3pb$1@smc.vnet.net> <200501130859.DAA04431@smc.vnet.net>
*Reply-to*: drbob at bigfoot.com
*Sender*: owner-wri-mathgroup at wolfram.com
Caveat emptor, however.
For a given Real number x, there are infinitely many algebraic numbers equal to it up to machine precision. TranscendentalRecognize can give you one of them, but there's no guarantee that this is the original form of the number. If the function gives you the simplest algebraic number that serves, obviously the number could have come from a more complicated one. Rationalize[x,0] also gives an exact form, too.
Bobby
On Thu, 13 Jan 2005 03:59:49 -0500 (EST), Paul Abbott <paul at physics.uwa.edu.au> wrote:
> 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
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
Prev by Date:
**Re: List element extraction**
Next by Date:
**Re: Problem with transformation rule of a function**
Previous by thread:
**Re: Mathematica is not very clever**
Next by thread:
**Re: Mathematica is not very clever**
| |