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
- References:
- Re: Confusing results with N[expr]?
- From: Peter Pein <petsie@dordos.net>
- Re: Confusing results with N[expr]?