MathGroup Archive 2001

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

Search the Archive

Re: Bump Function


In a message dated 12/14/01 5:32:55 AM, ajitkumar at math.mu.ac.in writes:

>Could  somebody tell me how to plot the graph of bump functions. For
>example, if I want to draw the graph of the function say,
>
>f(x,y) = x^2+y^2 for  x^2+y^2<1 
>   = 2  for x^2+y^2 >2
>

You did not define your function for 1 <= x^2+y^2<=2.  Let it be one there.

Clear[f];

f[x_, y_] := x^2 + y^2 /; x^2 + y^2 < 1;
f[x_, y_] := 2 /; x^2 + y^2 > 2;
f[x_, y_] := 1;

Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, 
    PlotPoints -> 50];

Clear[f];

f[x_, y_] := (x^2+y^2)+
      UnitStep[x^2+y^2-1]*(1-(x^2+y^2)) + 
      UnitStep[x^2+y^2-2];

Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, 
    PlotPoints -> 50];


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: Preserve subscripts like integers using N
  • Next by Date: Re: Preserve subscripts like integers using N
  • Previous by thread: Re: Bump Function
  • Next by thread: RE: Bump Function