Re: 3D plot of discontinuous function
- To: mathgroup at smc.vnet.net
- Subject: [mg24951] Re: 3D plot of discontinuous function
- From: "Ulrich Bodenhofer" <ulrich.bodenhofer at scch.at>
- Date: Fri, 25 Aug 2000 00:02:25 -0400 (EDT)
- Organization: Software Competence Center Hagenberg (http://www.scch.at/)
- References: <8mtcar$7tr@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Andrzej, first of all, thank you very much for spending the effort to write such a detailed description of how to solve my problem. Indeed, it solved the problem perfectly! I succeeded in producing magnificent pictures of really exotic functions (some types of pathological fuzzy relations, by the way). In order to make it a little easier, I defined the following function: Plot3DPart := DeleteCases[ DeleteCases[Graphics3D[Plot3D[##]], Indeterminate, Infinity], {_?NumberQ, _?NumberQ}, Infinity] &; Now, I can plot the parts really easy, e.g. f[x_, y_] := If[x <=y, 1, Indeterminate]; g[x_, y_] := If[x >y, 0, Indeterminate]; p1=Plot3DPart[f[x, y], {x, 0, 1}, {y, 0, 1}, DisplayFunction -> Identity, PlotPoints -> 26]; p2=Plot3DPart[g[x, y], {x, 0, 1}, {y, 0, 1}, DisplayFunction -> Identity, PlotPoints -> 26]; Show[p1, p2, DisplayFunction -> $DisplayFunction]; For complicated functions, however, this is still tedious work. Actually, I had to create up to 22 different graphics objects for visualizing one single function. But I suppose there is no way otherwise, since it is not realistic that some sophisticated method will ever be able to detect the discontinuities automatically. Just another aspect: The method you suggest is not only perfect for visualizing discontinuities, but also for lines of non-differentiability. I do not dare to post attachments to the newsgroup. However, if you (or anybody else in this group) are (is) interested in nice examples of plots of nasty functions, just contact me, and I will send some. Thanks a lot again, Ulrich -----Original Message----- From: Andrzej Kozlowski [mailto:andrzej at tuins.ac.jp] To: mathgroup at smc.vnet.net Subject: [mg24951] Re: [mg24779] 3D plot of discontinuous function 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. >