Go to CCP Homepage Go to Materials Page Go to Differential Equations Materials Go to Table of Contents
Go Back One Page Go Forward One Page

Maple Tutor

Part 8: Graphing Functions

  1. Let's plot 3 sin(2x) over the interval [0,2 pi]. Enter
    plot(3*sin(2*x), x=0..2*Pi);
    We can obtain the same result by defining the function f given by
    f(x) = 3 sin(2x)
    and plotting f(x). Enter the following:
    f:= x->3*sin(2*x);
    plot(f(x), x=0..2*Pi);

  2. When the plot appears, use your mouse to "select" it -- you should see a box around the graphic. Experiment with the drag buttons at the corners and sides of the box. Experiment with the icons at the top of the screen to see what they do. In particular, obtain each of the following:
  3. Next we plot data given as ordered pairs. Enter
    data:=[[0,1],[2,2],[4,6],[5,1]];
    Then enter
    plot(data, style=point);
    Go back and see what happens if you delete "style=point."

  4. Often we wish to view several graphs at the same time. One way to do this is to enter the desired plots directly into the plot command. Enter
    plot([sin(x),cos(x)],x=0..2*Pi, color=[green,blue]);

  5. Another way to create multiple plots is to use the display command in the plots package. Enter
    with(plots);
    Note that "display" is one of the tools available. Now enter
    graph1:=plot(sin(x),x=0..2*Pi,color=blue):
    This creates a plot and names it "graph1." Note that the colon is important. If you type a semicolon instead, you will see a list of the data Maple remembers to create the plot.

    Create a second plot by entering
    graph2:=plot(cos(x),x=0..2*Pi, color=green):

    To see both plots together, enter
    display(graph1,graph2);

    When you define and name a plot, you can also see it immediately by adding %; after the definition. Alter
    graph1:=plot(sin(x),x=0..2*Pi,color=blue):
    to read
    graph1:=plot(sin(x),x=0..2*Pi,color=blue):%;
    and reenter.

Go to CCP Homepage Go to Materials Page Go to Differential Equations Materials Go to Table of Contents
Go Back One Page Go Forward One Page


modules at math.duke.edu Copyright CCP and the author(s), 1998, 1999, 2000