Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Maple Help

  1. Mar 23, 2007 #1

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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 (Text):
    plot(f(theta),theta=-4*\pi..4*\pi, y=-4..4, discont=true);
    Thanks in advance.
     
  2. jcsd
  3. Mar 23, 2007 #2

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    Have you tried using "with(plots);" and searching up various commands that will do what you want to do?
     
  4. Mar 23, 2007 #3

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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?
     
  5. Mar 23, 2007 #4

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    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.
     
  6. Mar 23, 2007 #5

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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...
     
  7. Mar 23, 2007 #6

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    That'll never happen. :frown:

    Anyways, cheers and good luck with everything.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Maple Help
  1. Maple Help (Replies: 3)

  2. Maple Help! (Replies: 1)

  3. Maple help (Replies: 5)

  4. Help with maple (Replies: 0)

Loading...