Maple plot piecewise function for a mark scheme

In summary, Jason was trying to plot a function using maple but couldn't seem to get it to work. He then found a different way to do it and was successful.
  • #1
Hootenanny
Staff Emeritus
Science Advisor
Gold Member
9,623
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):=
\left\{\begin{array}{lcr}
-\theta-\pi & \text{for} & \pi<\theta< 0 \\
\pi-\theta & \text{for} & 0<\theta<\pi
\end{array}\right.
\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
  • #2
Have you tried using "with(plots);" and searching up various commands that will do what you want to do?
 
  • #3
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?
 
  • #4
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.
 
  • #5
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...
 
  • #6
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.
 

1. What is a "Maple plot piecewise function"?

A Maple plot piecewise function is a type of mathematical function that is defined in separate pieces or intervals. Each piece of the function has a specific domain where it is valid, and the function may have different expressions or rules for each interval.

2. How do I create a Maple plot piecewise function?

To create a Maple plot piecewise function, you can use the "piecewise" command in Maple. This command allows you to specify the different pieces or intervals of the function, along with their corresponding expressions or rules. You can also use the "plot" command to graph the function and visualize its different pieces.

3. What is the purpose of using a Maple plot piecewise function?

A Maple plot piecewise function is useful for representing mathematical functions that have different behaviors or rules in different intervals. It allows you to break down a complex function into simpler pieces, making it easier to understand and analyze. This type of function is commonly used in calculus, differential equations, and other areas of mathematics.

4. How can I use a Maple plot piecewise function for a mark scheme?

In a mark scheme, a Maple plot piecewise function can be used to demonstrate your understanding of how to graph and analyze this type of function. You can show the different pieces of the function and explain how they relate to each other. Additionally, you can use Maple to evaluate the function at specific points, find its derivatives or integrals, and check for continuity and differentiability.

5. Are there any limitations to using a Maple plot piecewise function?

One limitation of using a Maple plot piecewise function is that it can only represent functions with a finite number of intervals. Additionally, the function must have a specific rule or expression for each interval, which may not always be the case for more complex functions. It is important to carefully define and check the continuity and differentiability of the function to ensure its accuracy.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
873
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
954
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
245
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
731
  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top