Re: Bump Function
- To: mathgroup at smc.vnet.net
- Subject: [mg31982] Re: [mg31967] Bump Function
- From: BobHanlon at aol.com
- Date: Fri, 14 Dec 2001 16:53:15 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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