> 2 + 2 ;

Note the semicolon! This tells Maple that you have finished entering things and would like it to give you an answer. When you hit `Enter' (the key at the lower-right corner of the keyboard) you should see a 4 on the next line, and a new prompt looking for more input. Maple will do all of the simple forms of computation you are familiar with and much more besides. Here are some examples (everything after a # is a comment. You do not have to type it, and if you do, it will not be read in by Maple):

> 10 - 5 ; # 10 minus 5 > 25.5 * 4 ; # * means multiply > 25.5 / 4 ; # / means divide > 2^4 ; # 2*2*2*2, or 2 to the power of 4You can group expressions with parentheses, just as you do in ordinary math notation:

> (284 + 44) / 88 ;

Note that the result of the last computation is a rational number (a fraction): We will see how to change this to a real number (decimal number) a little later. Maple cares a great deal about whether you forget a character such as ``;'' or ``or spell a word wrong, but it does not mind extra spaces inserted between words or characters (though not within words of course). So following expressions are treated the same:

> (284 + 44) / 88 ; > ( 284+44 )/88;

> a := (284 + 44) / 88 ;

then the variable a now has the value > a ;

Here is another example:

> q := 9 ;

> q + 3 ;

We may want Maple to evaluate a, that is, to tell us what the decimal value of is. We can do this by typing:

> evalf(a) ;

Maple will also calculate functions. It already knows common functions such as sine, cosine, and square root (sqrt). You will read more about functions below.

> sin(1.2) ;

> sqrt(2) ;

2 to the power of a half is the same thing as square-root of two. A handy way to get Maple to evaluate the last expression is as follows:

> evalf(") ;

The

> E ;

>evalf(") ;

Exercises are numbered. In order to be sure of getting a grade of B, you must do correctly all those without a star. Exercises numbered with a star (e.g. 1.4*) are somewhat harder (though they should be do-able). Doing these in addition will head you towards an A or A+. All exercises should be completed and mailed to me by Monday, Sept. 18. A grade of F for this activity will be awarded to all submissions thereafter. Perform the following calculations. Note that we are not using Maple syntax; that is, you will have to translate the English into appropriate Maple expressions in order to do the calculations.

- 1.1: the square root of 1849
- 1.2: 1.384 multiplied by 48.9
- 1.3: to the power of 3 (use
**evalf()**to get a numerical value) - 1.4*: the product of the cosine (
**cos**) of and the tangent (**tan**) of /8

Get the symbolic answer first, that is, the answer expressed directly in terms of**cos**, etc.; then use**evalf(")**to get a numerical value.

> evalb(2.0 > 4.0) ;

> evalb(2.0 = sqrt(4.0)) ;

Comparisons like these are done one at a time. So, if we want to know whether 0.5 is between 0 and 1 (which it is), although we might write this as 0 < 0.5 < 1, in Maple we type:

> evalb(0 < 0.5 and 0.5 < 1) ;

The function

=, <, >, <= (less-than-or-equal), >=,

> evalb(3.4 < 2.7) ;

>evalb(not 3.4 < 2.7) ;

- 2.1: Test whether the square root of 117649 is equal to 347
- 2.2: Test whether the cosine of 12.5 is greater than 0 and less than 1
- 2.3*: Using assignment (see above), let
**number1**be the natural logarithm (**log**) of 3.0, let**number2**be the natural logarithm of 4.0. Then test whether the sum of**number1**and**number2**is equal to the natural logarithm of 12.0. (Note that you can type all three expressions, each followed by ``;'', before hitting `Enter'.)

> threetimes := x -> 3*x ; > threetimes(7) ;The first line says that

> plot(threetimes, 0..10) ;This will show the value of

> plot(threetimes) ;what is the difference? Here is a plot of the sine function from 0 to 25:

plot(sin, 0..25) ;Functions can be all sorts of expressions. Suppose you are interested in the function which maps all numbers less than 5 to -1, and all numbers greater than or equal to 5 to +1. You can define this function using an

if (some-condition) then some-action else some-other-action fiNote that the statement ends with ``if'' spelled backwards. This is the usual way to end long statements in Maple. Note also that you will need parentheses around the condition so that Maple knows where it ends. Here is an example:

> funnyfunction := x -> if (x < 5) then -1 else 1 fi ; > plot(funnyfunction) ;You can plot more than one function on the same graph, by making the first argument to

> plot({cos, funnyfunction}, 0..10) ;

- 3.1: The function which returns the difference between its input (x) and the square root of x
- 3.2: x cubed (i.e., x to the power of 3). Show values for -3 < x < 3
- 3.3*: The function which has the value x when x is between 5 and 10 and -x everywhere else. Show values for 0 < x < 15. Hint: You will need to use ``and''.

- 4.1: cosine of (0.5 * x)
- 4.2: the nearest integer to x (use round(x))
- 4.3: the square of the cosine of x
- 4.4*: assign the following values: a := 1, b := 1, c := 0. Now assign the function generalfunction to be a * (cos(x))^b + c. Plot this. Now assign b := 100, and note what changes. Reset b to 1, let a equal 10, and note what this does. Now let c equal -2, and note the result. Try out a few more values. If you're feeling bold, try b := -1. Now describe, as precisely as you can, what the effects are of varying a, b, and c. If you complete this exercise, you are really getting into the swing of things! (Note: For this exercise, you submit both the plots and the answers to the questions about how the output of the function varies with the values of a, b, and c.)

- 5.1: cos(x) and 2*cos(x)
- 5.2: sin(x) and sin(*x)
- 5.3: sin(x) and sin(3*x + 1)
- 5.4*: sin(x^2) and sin(x^3) (Plot this in the range from -4 to 4.)