Re: 3D plot of discontinuous function
- To: mathgroup at smc.vnet.net
- Subject: [mg24803] Re: [mg24779] 3D plot of discontinuous function
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 13 Aug 2000 03:16:42 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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.
--
Andrzej Kozlowski
Toyama International University, JAPAN
For Mathematica related links and resources try:
<http://www.sstreams.com/Mathematica/>
on 8/10/00 6:32 AM, Ulrich Bodenhofer at ulrich.bodenhofer at scch.at wrote:
> Hi,
>
> I am currently struggling with a problem that seems more and more
> non-trivial:
> How can I make a 3D plot of a discontinuous function, where the manifolds of
> discontinuities are not necessarily parallel to the axes (*). If they were,
> I could
> split the plot into rectangles where the function is continuous and
> reassemble
> them with Show[]. In the more general case, however, I do not have an
> idea how to solve this.
>
> 1. Plot3D does not support plotting over non-rectangular areas.
> 2. Splitting the plot into regions that can be drawn with ParametricPlot3D
> is (1) difficult and tedious, and (2) does not support meshes with
> varying numbers of points either.
>
> Does anybody have a clue? Any help is gratefully appreciated!
>
> Regards,
> Ulrich
>
> (*) Simple example with discontinuities along the diagonal: characteristic
> function of the linear ordering of real numbers, i.e.
> f[x_,y_]:=If[x<=y,1,0];
>
>
>
>