MathGroup Archive 2012

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

Search the Archive

Re: ContourPlot non rectangular evaluation?

Since you say you can find where the denominator g[x, y] == 0 and imply that tis is a "curve", I presume you already have, at least numerically, a function k[x] given implicitly by g[x, y] == 0, that is, satisfying g[x, k[x]] == 0.

The condition for a point {x, y} to be above the curve g[x, y] == 0 is therefore that y > k[x]. Then use that condition in the RegionFunction option.

For example:

   f[x_, y_] := x^3y - 4 Exp[y -x]
   g[x_, y_] := x^2 - y^3
   h[x_, y_] := f[x, y]/g[x ,y]
   k[x_] := Abs[x]^(2/3)

   ContourPlot[h[x, y], {x, -2, 2}, {y, 0, 3},
      Exclusions -> {g[x, y] == 0},
      RegionFunction -> Function[{x, y}, y > k[x]],
      Contours -> 10]

On Aug 25, 2012, at 4:26 AM, Sam McDermott <samwell187 at> wrote:
> I'd like to make a plot of level curves of a function, but this =
function becomes singular and passes from infinity to negative infinity, =
which really uglifies the plot. It is easy for me to identify where the =
function becomes singular (i.e., when the denominator becomes 0!), but =
I'm having trouble telling Mathematica to stop evaluating before then, =
because this singularity is sensitive to both of the variables on the =
axes of my ContourPlot. Is there a simple way of telling Mathematica =
where to stop?
> In other words,  I have some function
> h[x_,y_]:=f[x,y]/g[x,y]
> and I can numerically find the zeroes of g[x,y]. Can I make a =
ContourPlot such that
> ContourPlot[h[x,y],{x,xmin,xmax},{y,ymin,ymax}]
> does not evaluate below the curve
> g[x,y]=0
> ?
> I think I'm basically looking for some way of setting assumptions of =
evaluating an "If" conditional inside of ContourPlot but can't find a =
good way of doing it. Any help would be much appreciated!

Murray Eisenberg                                     =
murray at
Mathematics & Statistics Dept.      
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                  413 545-2859 (W)
710 North Pleasant Street                      fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Re: ContourPlot non rectangular evaluation?
  • Next by Date: Mathematica issue
  • Previous by thread: Re: ContourPlot non rectangular evaluation?
  • Next by thread: Re: ContourPlot non rectangular evaluation?