MathGroup Archive 2005

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

Search the Archive

Re: Re: Confusing results with N[expr]?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62358] Re: [mg62327] Re: Confusing results with N[expr]?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 22 Nov 2005 04:41:59 -0500 (EST)
  • References: <dlp320$1bs$1@smc.vnet.net> <200511210854.DAA22039@smc.vnet.net> <7EF1243C-78FD-4926-8E96-72AF496B0E91@mimuw.edu.pl>
  • Sender: owner-wri-mathgroup at wolfram.com

On 21 Nov 2005, at 21:09, Andrzej Kozlowski wrote:

>
> On 21 Nov 2005, at 17:54, Peter Pein wrote:
>
>> 2.)
>> Unprotect[Power];
>> Power /: N[(x_)^(y_)] := Pow$[N[x], N[y]];
>> Protect[Power];
>> $Post = #1 /. Pow$ -> Power & ;
>>
>
> Well, I would not recommend it. As often happens if you change one  
> of the basic arithmetic functions,  there is be a price to pay if  
> you do this. Here is an example:
>
> In[1]:=
> Unprotect[Power];
> Power /: N[(x_)^(y_)] := Pow$[N[x], N[y]];
> Protect[Power];
> $Post = #1 /. Pow$ -> Power & ;
>
> In[5]:=
> Solve[N[x^2 - 1 == 0], x]
>
> "Inverse functions are
>     being used
>       by   so some solutions may not be \
> found; use Reduce for complete solution information.
>
> Out[5]=
> {}
>
> Solving polynomial equations has suddenly become  harder (although,  
> of course, if you do not use N things will still work fine).
>
> Andrzej Kozlowski


Actually, there is more. Try this:


Unprotect[Power];
Power /: N[(x_)^(y_)] := Pow$[N[x], N[y]];
Protect[Power];
$Post = #1 /. Pow$ -> Power & ;


Plot[1,{x,0,1}]

or for that matter any other Plot. It's a nice puzzle to try work out  
how this comes about ;-)

Andrzej Kozlowski


  • Prev by Date: Re: How to read a data file in text format?_from a new learner
  • Next by Date: Re: TagSetDelayed and UpValues
  • Previous by thread: Re: Re: Confusing results with N[expr]?
  • Next by thread: Re: Re: Confusing results with N[expr]?