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


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