Maple plot piecewise function for a mark scheme

Click For Summary

Discussion Overview

The discussion revolves around plotting a piecewise function using Maple software for a mark scheme. Participants share their experiences and solutions related to defining and plotting the function, as well as addressing issues encountered during the plotting process.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant describes a piecewise function and expresses difficulty in plotting it using Maple, noting that the software hangs when attempting to execute the plot command.
  • Another participant suggests using the "with(plots);" command and searching for various commands that could assist in plotting the function.
  • A participant inquires about the possibility of defining different restricted domains for each piece of the piecewise function in the plot.
  • Further clarification is provided on how to create multiple plots with restricted domains using separate plot commands and then displaying them together.
  • A participant reports successfully resolving their issue using the suggested commands and expresses gratitude, indicating they will share their code and plot later.

Areas of Agreement / Disagreement

Participants generally agree on the methods to plot piecewise functions in Maple, but there is no consensus on the specific implementation details, as some participants are still exploring solutions.

Contextual Notes

Some limitations include potential misunderstandings of Maple commands and the need for clarification on how to effectively define and plot piecewise functions with restricted domains.

Hootenanny
Staff Emeritus
Science Advisor
Gold Member
Messages
9,621
Reaction score
9
I need to plot the following piecewise function for a mark scheme I'm writing, but I can't seem to get maple to plot it. I can define the function, but when I ask maple to plot it, it just hangs. Any help would be much appreciated. The function;

[tex]f(\theta):=<br /> \left\{\begin{array}{lcr}<br /> -\theta-\pi & \text{for} & \pi<\theta< 0 \\<br /> \pi-\theta & \text{for} & 0<\theta<\pi<br /> \end{array}\right.<br /> \text{and}f(\theta+2\pi)=f(theta)[/tex]

And I use the following command to try and plot it :frown: ;
Code:
plot(f(theta),theta=-4*\pi..4*\pi, y=-4..4, discont=true);
Thanks in advance.
 
Physics news on Phys.org
Have you tried using "with(plots);" and searching up various commands that will do what you want to do?
 
Hi Jason, thanks for the reply. I'm looking at fiddling it and doing a multiple plot of the different functions. Is is possible to define different restricted domains for each function?
 
Hootenanny said:
Hi Jason, thanks for the reply. I'm looking at fiddling it and doing a multiple plot of the different functions. Is is possible to define different restricted domains for each function?

That's what I tried to do first.

I think you can actually. I forgot about this other method.

Ok, for one part, do...

p1:=plot(function,x=a..b):

So, you call the first plot with the boundaries p1. I use colon because we don't need the plot to come yet.

Then, do the next part of the plot...

p2:=plot(function,x=a..b):

So, they are your restricted domains respectfully.

Now, to see both together, you can do...

display({p1,p2});

I'm not sure how that will look, but you can try it out. If you don't understand what I'm saying, let me know.
 
Thanks Jason, I've just figured it out now using your with(plots) command, it's been a real pain in the arse! I'll post the code and the plot for those who are interested when I've finished.

Thanks again Jason, next time your in the UK, let me buy you a beer...
 
Hootenanny said:
Thanks again Jason, next time your in the UK, let me buy you a beer...

That'll never happen. :frown:

Anyways, cheers and good luck with everything.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K