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 7: Functions

  1. Next we define a function to assign the value 10 sin x to each x. Enter
    x:='x';
    f:=x->10*sin(x);

    and then
    f(1);
    You may be surprised to see

    10 sin(1)

    rather than a decimal approximation. To obtain a decimal approximation, enter
    evalf(10*sin(1));
    The command "evalf" stands for "floating point evaluation."


  2. To be sure that the action of evalf is clear, enter
    103751/2053;
    and then
    evalf(103751/2053);
  3. An alternate way of forcing Maple to return a decimal approximation to f(1) is to enter
    f(1.0);

  4. Note that Maple distinguishes between a function and an expression. Enter
    g(x):=10*sin(x);
    Then enter
    g(1);
    followed by
    g(x);
    The symbols g(x) stand for the expression, not the function.

  5. Let's evaluate f at pi/6. First, we need the value of pi. Enter
    Pi;
    Alter this line to read
    evalf(Pi);
    Compare this with
    pi;
    evalf(pi)

    Both "pi" symbols look the same, but only the one obtained with an upper case "P" and a lower-case "i" carries the numerical value.

    Now find a decimal approximation to f(pi/6).

  6. Find a decimal approximation to each of the following: f(2) and f(pi/3).

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