Re: 3D plot of discontinuous function
- To: mathgroup at smc.vnet.net
- Subject: [mg24804] Re: [mg24779] 3D plot of discontinuous function
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 13 Aug 2000 03:16:43 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
A small addition to the previous method. The graphic objects constructed in my previous solution are "illegitimate", in the sense that they contain the non-numerical vlaue "Indeterminate" where a number is expacted. However, we can easily convert them to perfectly legitimate grahic objects and even obtain a better picture as follows: p1 = DeleteCases[ DeleteCases[Graphics3D[p1], Indeterminate, Infinity], {_?NumberQ, _?NumberQ}, Infinity]; p2 = DeleteCases[ DeleteCases[Graphics3D[p2], Indeterminate, Infinity], {_?NumberQ, _?NumberQ}, Infinity]; We can now turn on the error messages with: In[27]:= On[Plot3D::"plnc"] In[28]:= On[Plot3D::"gval"] In[29]:= On[Graphics3D::"nlist3"] Evaluating In[30]:= Show[p1, p2, DisplayFunction -> $DisplayFunction] will produce a slightly better picture without any error messages. Andrzej on 8/10/00 7:51 PM, Andrzej Kozlowski at andrzej at tuins.ac.jp wrote: > Here is the simplest method I can think of. I will use your example. > > The method woudl normally produce several error messags, so we first supress > them: > > In[1]:= > Off[Plot3D::"plnc"] > In[2]:= > Off[Plot3D::"gval"] > In[3]:= > Off[Graphics3D::"nlist3"] > > > Now, we define two functions f and g by: > > In[4]:= > f[x_, y_] := If[x > y, 1, Indeterminate] > > In[5]:= > g[x_, y_] := If[x < y, 0, Indeterminate] > > and two graphs: > > In[6]:= > p1 = Plot3D[f[x, y], {x, -1, 1}, {y, -1, 1}, PlotPoints -> 50, > DisplayFunction -> Identity]; > > In[7]:= > p2 = Plot3D[g[x, y], {x, -1, 1}, {y, -1, 1},PlotPoints -> 50, DisplayFunction > -> Identity]; > > Now > > In[8]:= > Show[p1, p2, ViewPoint -> {-5.339, -2.848, 2.830}, > DisplayFunction -> $DisplayFunction] > > produces a reasonable representation of a discontinuous function. >