active01_830.mw

active01_830.mw

Wed Aug 31 16:55:21 MDT 2005

This sheet just goes over the stuff we did in class on day one, 8/25/05.

To run the entire sheet, top-to-bottom, and in order, click on the !!! icon at the upper right of your window.

> restart;

The arithmetic operations at the top of page 2 (along with Pi, %, and "evalf"):

> 2 + 5;

7

> 2*5;

10

> 2/5;

2/5

> evalf(%);

.4000000000

> 2^5;

32

> 2^(1/2);

2^(1/2)

> evalf(%);

1.414213562

> 2^0.5;

1.414213562

> (5+Pi)/(5-Pi);

(5+Pi)/(5-Pi)

> evalf(%);

4.380951610

> 3 + 2*(12 - 7);  Parentheses are the only algebra grouping symbol.  The other usual grouping symbols get used for other purposes.

13

> 3 + 2*[12 - 7];

3+[10]

> 3 + 2*{12 - 7};

3+2*{5}

Evaluating various elementary functions listed in mid page 2:

Evaluating various elementary functions listed in mid page 2:

> abs(-23);

23

> sqrt(4+2*14);

4*2^(1/2)

> sqrt(4.0+2*14);

5.656854249

> exp(1);  exp(1.0);

exp(1)

2.718281828

> sqrt( exp(2) );

exp(1)

> ln(2);

ln(2)

> ln(2.0);

.6931471806

> ln(8) - 3*ln(2);

0

> sin(4)^2 + cos(4)^2;

sin(4)^2+cos(4)^2

> evalf(%);

1.000000000

> sin(4.0)^2 + cos(4)^2;

.5727500169+cos(4)^2

> arctan(1);

1/4*Pi

> sin( arctan(1) );

1/2*2^(1/2)

Assigning variables in Maple

> r := 3;

r := 3

> R := 4;  Note that Maple is case-sensitive, that is, variables R and r are different.

R := 4

> R, r;

4, 3

> AnnulusArea := Pi*(R^2 - r^2);  evalf(%);

AnnulusArea := 7*Pi

21.99114858

> Discriminant := b^2 - 4*a*c;  "Discriminant" is a Maple expression (see page 15)

Discriminant := b^2-4*a*c

> Discriminant;  Echo back the expression.

b^2-4*a*c

> a := 3;  b := -2;  c := 3;  Assign some values to variables in the expression.

a := 3

b := -2

c := 3

> Discriminant;  Now the expression is evaluated because Maple knows the values of the variables.

-32

> nerk := sqrt(Pi);

nerk := Pi^(1/2)

> evalf(nerk);

1.772453851

>

Defining Maple functions

> fox := x -> 3*x^2 - 7*x + 4;  Defining a function named "fox".

fox := proc (x) options operator, arrow; 3*x^2-7*x+4 end proc

> fox(-2);

30

> fox(t);

3*t^2-7*t+4

> fox(t + h);

3*(t+h)^2-7*t-7*h+4

> fox(x+h) - fox(x);

3*(x+h)^2-7*h-3*x^2

Plotting Maple Functions

> plot(fox);   A default plot of function "fox"

[Plot]

> plot(fox, 0..3);   Shrinking the range of x-values plotted.

[Plot]

> plot(fox, 0..3, -1..1);  Chop the y-range as well.

[Plot]

> gum := x -> (x^2 - 4)/(x+1);  "gum" is the function version of the expression hatched in mid page 6.

gum := proc (x) options operator, arrow; (x^2-4)/(x+1) end proc

> gum(0);

-4

> gum(-1);

Error, (in gum) numeric exception: division by zero

> plot(gum);  As pointed out on page 6, this plot is not too informative.

[Plot]

> plot( gum, -4..4, -8..8 );  Trimming the x- and y-ranges gives us this non-function graph.  This is an artifact of Maple's default propensity to connect the points it plots with line segments.

[Plot]

> plot( gum, -4..4, -8..8, style=POINT ); We can make Maple stop connecting points with line segments by use of "style = POINT".  The plot shows spurious points, however.  Function "gum" is difficult for computer graphing to cope with.

[Plot]

> plot( gum, -4..4, -8..8, style=POINT, numpoints=1000 );  Plot more points.

[Plot]

> plot( gum, -4..4, -8..8, style=POINT, numpoints=1000, discont=true ); The "discont=true" option warns Maple away from plotting the near-asymptote spurious points.

[Plot]

>