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; |
| > | 2*5; |
| > | 2/5; |
| > | evalf(%); |
| > | 2^5; |
| > | 2^(1/2); |
| > | evalf(%); |
| > | 2^0.5; |
| > | (5+Pi)/(5-Pi); |
| > | evalf(%); |
| > | 3 + 2*(12 - 7); Parentheses are the only algebra grouping symbol. The other usual grouping symbols get used for other purposes. |
| > | 3 + 2*[12 - 7]; |
| > | 3 + 2*{12 - 7}; |
Evaluating various elementary functions listed in mid page 2:
Evaluating various elementary functions listed in mid page 2:
| > | abs(-23); |
| > | sqrt(4+2*14); |
| > | sqrt(4.0+2*14); |
| > | exp(1); exp(1.0); |
| > | sqrt( exp(2) ); |
| > | ln(2); |
| > | ln(2.0); |
| > | ln(8) - 3*ln(2); |
| > | sin(4)^2 + cos(4)^2; |
| > | evalf(%); |
| > | sin(4.0)^2 + cos(4)^2; |
| > | arctan(1); |
| > | sin( arctan(1) ); |
Assigning variables in Maple
| > | r := 3; |
| > | R := 4; Note that Maple is case-sensitive, that is, variables R and r are different. |
| > | R, r; |
| > | AnnulusArea := Pi*(R^2 - r^2); evalf(%); |
| > | Discriminant := b^2 - 4*a*c; "Discriminant" is a Maple expression (see page 15) |
| > | Discriminant; Echo back the expression. |
| > | a := 3; b := -2; c := 3; Assign some values to variables in the expression. |
| > | Discriminant; Now the expression is evaluated because Maple knows the values of the variables. |
| > | nerk := sqrt(Pi); |
| > | evalf(nerk); |
| > |
Defining Maple functions
| > | fox := x -> 3*x^2 - 7*x + 4; Defining a function named "fox". |
| > | fox(-2); |
| > | fox(t); |
| > | fox(t + h); |
| > | fox(x+h) - fox(x); |
Plotting Maple Functions
| > | plot(fox); A default plot of function "fox" |
![[Plot]](active01_830_46.gif)
| > | plot(fox, 0..3); Shrinking the range of x-values plotted. |
![[Plot]](active01_830_47.gif)
| > | plot(fox, 0..3, -1..1); Chop the y-range as well. |
![[Plot]](active01_830_48.gif)
| > | gum := x -> (x^2 - 4)/(x+1); "gum" is the function version of the expression hatched in mid page 6. |
| > | gum(0); |
| > | 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]](active01_830_51.gif)
| > | 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]](active01_830_52.gif)
| > | 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]](active01_830_53.gif)
| > | plot( gum, -4..4, -8..8, style=POINT, numpoints=1000 ); Plot more points.
|
![[Plot]](active01_830_54.gif)
| > | 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]](active01_830_55.gif)
| > |