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

• To: mathgroup at smc.vnet.net
• Subject: [mg46584] Re: [mg46569] How to set y always greater than or equal to x for a function?
• From: Oleksandr Pavlyk <pavlyk at phys.psu.edu>
• Date: Tue, 24 Feb 2004 21:04:34 -0500 (EST)
• Organization: Penn State University; Department of Physics
• References: <200402240333.WAA20733@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Depending on what you want, you can either proceed by
defining you function in the valid domain:

Off[Plot3D::plnc]; Off[Plot3D::gval];
Plot3D[If[y - x > 0, Sqrt[y - x]], {x, -100, 100}, {
y, -100, 100}, PlotPoints -> 100];
On[Plot3D::plnc]; On[Plot3D::gval];

Then Mathematica complains about function being not a number,
and this is why these Plot3D messages are turned off.

One alternative way to proceed would be to modify your function,
and add Abs under the square root:

Plot3D[Sqrt[Abs[y-x]], {x,-100,100},{y,-100,100}]

Sasha

Albert Franco 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?
>
> Any help will be appreciated.
>
> Albert Franco

```

• Prev by Date: a question about [[ ]]
• Next by Date: Inversion using Cholesky Decomposition
• Previous by thread: 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?