RE: plotting with boundary conditions
- To: mathgroup at smc.vnet.net
- Subject: [mg34520] RE: [mg34482] plotting with boundary conditions
- From: "Annetts, Dave (E&M, North Ryde)" <David.Annetts at csiro.au>
- Date: Fri, 24 May 2002 02:42:39 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Raj, to plot a surface > f(a,b) = a^2-2*c(a,b)+b^2; given the boundary conditions c(a,b)< ab > > Here c(a,b) is another function of (a,b) given by > c(a,b) = 0.1*(a-1)^2+0.1*(b-1)^2-0.01 > > Is there a direct command to set these boundary > conditions...?? If i give > > f[a_, b_] := If[c[a, b] < a*b, a^2 + b^2 - 2*c[a, b],]; > > Plot3D[f[a, b], {a, 0, 2}, {b, 0, 2}, AxesLabel -> {"a", "b", "f"}, > ViewPoint -> {2, 2, 2}] > > I get error messages for the values of a and b for which > f(a,b) doesnot exist. > > Can anybody please tell me how i can get this plot? After defining your function c, it works fine ... c[a_, b_] := 0.1*(a-1)^2+0.1*(b-1)^2-0.01 f[a_,b_]:=If[c[a,b]<a*b,a^2+b^2-2*c[a,b],Null]; Plot3D[f[a,b],{a,0,2},{b,0,2},AxesLabel\[Rule]{"a","b","f"}, ViewPoint\[Rule]{2,2,2}]; You can supress the warnings by setting Off[Plot3D::plnc]; Off[Plot3D::gval]; Regards, Dave. -------------------------------------------------------- Dr. David Annetts EM Modelling Analyst Tel: (+612) 9490 5416 CSIRO DEM, North Ryde Fax: (+612) 9490 5467 David.Annetts at csiro.au Include "usual_disclaimers" --------------------------------------------------------