MathGroup Archive 2006

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

Search the Archive

Re: Unexpected "Invalid comparison" error when plotting function defined with a Condition pattern

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69238] Re: Unexpected "Invalid comparison" error when plotting function defined with a Condition pattern
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sun, 3 Sep 2006 01:39:40 -0400 (EDT)
  • References: <ed68td$jgk$1@smc.vnet.net> <ed92v5$p46$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Jens-Peer Kuska schrieb:
> Hi,
> 
> just read the error message -- 10^y gaves a small 
> imaginary part and
> 
> g[x_?NumericQ /; 0 < Chop[x]] := x
> 
> will fix the problem.
> 
> Regards
>   Jens
> 

Hi,

it is really not obvious, that 10^y =Exp[y Log[10]] returns an imaginary 
part for any real y. If one doesn't have this in mind, a sequence of 
statements like :

f[x_?Positive]:=x;
f[x_]:=0;
Plot[Abs[f[10^y-50]],{y,1,2}]

would just "redraw" the x-axis :-(

Not only a trap for beginners...

Peter


  • Prev by Date: Re: Dot Product in Cylindrical Coordinates
  • Next by Date: Re: Problem with using /.
  • Previous by thread: RE: Unexpected "Invalid comparison" error when plotting function defined with a Condition pattern
  • Next by thread: Re: Unexpected "Invalid comparison" error when plotting function defined with a Condition pattern