MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: 3D plot of discontinuous function

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


Now, we define two functions f and g by:

f[x_, y_] := If[x > y, 1, Indeterminate]

g[x_, y_] := If[x < y, 0, Indeterminate]

and two graphs:

p1 = Plot3D[f[x, y], {x, -1, 1}, {y, -1, 1}, PlotPoints -> 50,
      DisplayFunction -> Identity];

p2 = Plot3D[g[x, y], {x, -1, 1}, {y, -1, 1},PlotPoints -> 50,
DisplayFunction -> Identity];


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:

on 8/10/00 6:32 AM, Ulrich Bodenhofer at ulrich.bodenhofer 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];

  • Prev by Date: Custom build for MathLink examples in MS Visual Studio 6.0
  • Next by Date: Re: Re: ArcCos[]
  • Previous by thread: Re: 3D plot of discontinuous function
  • Next by thread: RE: 3D plot of discontinuous function