View Full Version : Piecewise defined discontinuous functions in Mathematica

03-16-2005, 08:51 AM
Anyone know how to graph a piecewise defined discontinuous function in Mathematica so that the discontinuities actually show up?

I googled and found a solution here (http://online.ohlone.cc.ca.us/math/bbradshaw/mathematica/graphics_2d.pdf) but it doesn't work. I've been editing the graphs with microsoft paint to make them look discontinuous but it is very time consuming, especially since I need to create so many graphs.

Anyone have any experience with this?

03-16-2005, 09:02 AM
Did you try what was shown in that document at the bottom of page 9?

In order to create a discontinuous graph, plot the portions separately and then combine using the Show command.

03-16-2005, 09:04 AM
Yup it errors out:(

03-16-2005, 09:23 AM
I remember that document also saying something about errors because of the domain being used for a particular function. Show us the function along with the command you are using to plot it.

03-16-2005, 09:24 AM
I tried to plot the same one they had there and it didn't work.

03-16-2005, 12:37 PM
Excatly what do you mean by "discontinuities actually show up"?

I barely know any Mathematica but I just did this:

p1 := Plot[ x , {x, -1, 1}];
p2 := Plot[x + 2, {x, 1, 3}];
Show[p1, p2];

In the last plot a discontinuous function is shown. To me, the discontinuity is clearly shown.

03-16-2005, 01:24 PM
Thank you!:)

For some reason when I used the code in that pdf it did not work. Next time I should try rereading about the show function in the documentation.

I still have to edit the graphs though because I want to indicate whether there is a hole in the graph at a certain point but that is no big deal I guess.