MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Numeric warnings during symbolic manipulation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112804] Re: Numeric warnings during symbolic manipulation
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 1 Oct 2010 05:41:16 -0400 (EDT)

On 30 Sep 2010, at 10:51, Daniel Lichtblau wrote:

> Yaroslav Bulatov wrote:
>> Last two expressions are equivalent. Why does the second one gives
>> "N::meprec" warnings? Also, is there a good way to stop Mathematica
>> from running N on my intermediate expressions?
>>
>> a == 2/(4 + 1/E^2 + 2 E^2 + E^6) + E^2/(4 + 1/E^2 + 2 E^2 + E^6) +
>>   E^6/(4 + 1/E^2 + 2 E^2 + E^6);
>> b == 4/(4 + 1/E^2 + 2 E^2 + E^6) + 1/(
>>   E^2 (4 + 1/E^2 + 2 E^2 + E^6)) + (2 E^2)/(
>>   4 + 1/E^2 + 2 E^2 + E^6) + E^6/(4 + 1/E^2 + 2 E^2 + E^6);
>> Exp[Log[a/b]]
>> Exp[Log[a] - Log[b]]
>
> There is no compelling reason for that message. There is a reason for
> using numerical evaluation. In this case it is to assess imaginary part=

> of the exponent, in order to reduce by an appropriate integral multiple=

> of Pi. Regardless of whether one regards this as good or bad, I am not
> aware of any way to prevent it.
>
> Daniel Lichtblau
> Wolfram Research
>

You can avoid numerical evaluation if you hold off evaluation till the end and use Simplify like this:

Simplify[Unevaluated[Exp[Log[a] - Log[b]]]]

(E^2*(2 - E^2 + E^4))/(1 + 3*E^2 - E^4 + E^6)

Of course that is cheating since the definitions the values of a and b are not actually substituted until the final evaluation, but still this is sometimes a useful thing to do.

Andrzej Kozlowski




  • Prev by Date: Re: How to unflatten an array ?
  • Next by Date: Re: How to unflatten an array ?
  • Previous by thread: Re: Mathematica calculates RSquared wrongly?
  • Next by thread: Re: 4 Gb are not enough ...