RE: How to set y always greater than or equal to x for a function?
- To: mathgroup at smc.vnet.net
- Subject: [mg46577] RE: [mg46569] How to set y always greater than or equal to x for a function?
- From: David.Annetts at csiro.au
- Date: Tue, 24 Feb 2004 21:04:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Albert,
> 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?
What's wrong with
Plot3D[If[y >= x, Sqrt[y - x]], {x, -100, 100}, {y, -100, 100}];
If the warning messages bother you, investigate If[...] further, and adjust
the PlotRange accordingly.
Regards,
Dave.