MathGroup Archive 2004

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

Search the Archive

Re: How to set y always greater than or equal to x for a function?


Albert Franco <francoatnsuok at earthlink.net> wrote:
> I recently purchased Mathematica 5.0, and I am in the process of
> learning how to take advantage of it's many features.
>
> This is an example of one line I would like to calculate in Mathematica:
>
> Plot3D[Sqrt[y-x],{x,-100,100},{y,-100,100}];
>
> How can I best edit this line to make y always greater than or equal to x
> during calculation so the program doesn't try to take the square root of
> a negative number?

I've seen several responses so far, and am not really happy with any of
them. Before making my suggestion, let me say that I'm not happy with it
either! Nonetheless, it does have some virtues: It is not terribly
complicated. It does not show the function to be 0, when in fact it isn't
even real. No error messages are generated. The boundary at z = 0 is
appears less jagged.

I suggest

Plot3D[Sign[y - x] Sqrt[Abs[y - x]], {x, -100, 100}, {y, -100, 100},
PlotRange -> {0, Automatic}, PlotPoints -> 75, Mesh -> False,
ClipFill -> None]

Regards,
David Cantrell


  • Prev by Date: Re: Howto turn off using symbols to tag objects?
  • Next by Date: Re: ListPlot output
  • Previous by thread: RE: How to set y always greater than or equal to x for a function?
  • Next by thread: Re: How to set y always greater than or equal to x for a function?