C Board  

Go Back   C Board > Community Boards > General Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 03-16-2005, 08:51 AM   #1
.........
 
Join Date: Nov 2002
Posts: 303
Piecewise defined discontinuous functions in Mathematica

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 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?
SourceCode is offline   Reply With Quote
Old 03-16-2005, 09:02 AM   #2
Registered User
 
hk_mp5kpdw's Avatar
 
Join Date: Jan 2002
Location: Northern Virginia/Washington DC Metropolitan Area
Posts: 2,870
Did you try what was shown in that document at the bottom of page 9?

Quote:
In order to create a discontinuous graph, plot the portions separately and then combine using the Show command.
__________________
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
--Charles Babbage, 1792-1871

09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Last edited by hk_mp5kpdw; 03-16-2005 at 09:23 AM.
hk_mp5kpdw is offline   Reply With Quote
Old 03-16-2005, 09:04 AM   #3
.........
 
Join Date: Nov 2002
Posts: 303
Yup it errors out
SourceCode is offline   Reply With Quote
Old 03-16-2005, 09:23 AM   #4
Registered User
 
hk_mp5kpdw's Avatar
 
Join Date: Jan 2002
Location: Northern Virginia/Washington DC Metropolitan Area
Posts: 2,870
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.
__________________
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
--Charles Babbage, 1792-1871

09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
hk_mp5kpdw is offline   Reply With Quote
Old 03-16-2005, 09:24 AM   #5
.........
 
Join Date: Nov 2002
Posts: 303
I tried to plot the same one they had there and it didn't work.
SourceCode is offline   Reply With Quote
Old 03-16-2005, 12:37 PM   #6
and the hat of marbles
 
Sang-drax's Avatar
 
Join Date: May 2002
Location: Lund, Sweden
Posts: 2,041
Excatly what do you mean by "discontinuities actually show up"?

I barely know any Mathematica but I just did this:
Code:
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.
__________________
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Sang-drax is offline   Reply With Quote
Old 03-16-2005, 01:24 PM   #7
.........
 
Join Date: Nov 2002
Posts: 303
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.
SourceCode is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching functions to a class/struct Bubba Tech Board 2 08-04-2003 10:56 AM
Expression Manipulator v0.2 (bug fixes, functions) ygfperson A Brief History of Cprogramming.com 4 05-26-2003 04:52 PM
Help! User defined functions AdrenalinFlow C Programming 3 02-22-2003 07:36 PM
API "Clean Up" Functions & delete Pointers :: Winsock kuphryn Windows Programming 2 05-10-2002 06:53 PM
functions defined as a string river-wind C Programming 2 11-21-2001 10:36 AM


All times are GMT -6. The time now is 07:44 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22