adv_intr.mws
Advisory meeting with prospective
first year students, Tues. 26th. Sept. 2000
A very, very, very brief introduction to Maple
Here our modest aim is to introduce you to the Computer Algebra System (CAS) known as Maple, the CAS that we use throughout our three year mathematics programme. What you are seeing here is an example of a Maple worksheet (whose saved name - as you see above - is adv_intr.mws), and you will soon learn how to create such a worksheet from scratch.
The four basic things that Maple can do do are
- numerical and algebraic calculations
- graphical constructions (for plotting graphs, etc. Here I limit myself to just one.)
- programming (a very big topic; here just one brief, simple example)
Examples
Numerical (compare with what a calculator could/couldn't do) and algebraic calculations.
I begin with addition, subtraction, multiplication, division, some powers, and factorial:
 |
(1) |
| > |
988888888888888888888888888888777777777 + 1111111112222222222223333333333444444444445555555555555; |
 |
(2) |
 |
(3) |
 |
(4) |
 |
(5) |
 |
(6) |
 |
(7) |
| > |
3987654321009998888889995555555588888888888888888888*121212999999999999999999999991217777777234343400999887654321; |

 |
(8) |
 |
(9) |
 |
(10) |
 |
(11) |
And this is how to compute , and a few other powers:
 |
(13) |
 |
(14) |
And now for some factorial calculations. Here is how to compute 4!
 |
(16) |
You can predict the output from?:
 |
(17) |
and this?:
 |
(18) |
but this?:
What would you expect to see as output from the following command?:
 |
(20) |
and from this?:
and this command tells us that has
 |
(22) |
digits.
There is so much more that I could show you...
Let's have a quick look at some algebraic computations (where I make some deliberate mistakes, just to let you see how Maple responds):
 |
(23) |
 |
(24) |
| Error, missing operator or `;` |
|
 |
(25) |
 |
(26) |
| > |
expand((3*x - 2)*(5*x + 4)); |
 |
(28) |
| > |
factor(15*x^2 + 2*x - 8); |
 |
(29) |
 |
(30) |
 |
(31) |
 |
(32) |
 |
(33) |
 |
(34) |
 |
(35) |
 |
(36) |
Of course, you shouldn't just be looking at me (using Maple) doing these calculations, you should - and perhaps you are - be observing something like:
oh, look, those two factorisations - of () and () - came out quite differently...
Does that have something to do with ... ?
 |
(37) |
| > |
factor(a^4 + a^2*b^2 + b^4); |
 |
(38) |
 |
(39) |
And why didn't that one factor?...
Some polynomials factor; some don't (just as some whole numbers factor (composites), some don't (primes)). It requires some study to know why that happens...
Maple can also factor whole numbers as products of prime numbers:
 |
(40) |
 |
(41) |
 |
(42) |
 |
(43) |
 |
(44) |
was the largest known prime until 1954...
 |
(45) |
 |
(46) |
 |
(47) |
and here are some things we can do to see a number of things (like the above) that we might be interested in:
| > |
array([[n, x^2 - n], seq([n, factor(x^2-n)], n = 1..7)]); |
 |
(48) |
and this is an example of a very simple programme:
| > |
for n from 8 to 20 do
[n, factor(x^2 - n)]
od; |
Maple can solve equations:
| > |
solve(x^2 - 5*x + 6 = 0); |
 |
(50) |
| > |
solve(a*x^2 + b*x + c = 0); |
 |
(51) |
| > |
solve(a*x^2 + b*x + c = 0, x); |
 |
(52) |
| > |
solve(x^2 - x - 3 = 0); |
 |
(53) |
| > |
fsolve(x^2 - x - 3 = 0); |
 |
(54) |
| > |
plot(x^2 - x - 3, x = -2..3); |
Some analytic computations:
- some differentiations (calculate of whatever ... )
- some integrations (given whatever, what do you have to differentiate to get whatever ... )
 |
(55) |
 |
(56) |
| > |
diff(x^3 - 5*x^2 + 712, x); |
 |
(57) |
 |
(58) |
 |
(59) |
| > |
diff((x^3 - 2)/(2*x^2 + 5*x - 3), x); |
 |
(60) |
 |
(61) |
 |
(62) |
meaning: .
| > |
int(7*x^2 - 3*x + 4, x); |
 |
(63) |
 |
(64) |
| > |
int(x^-20, x); # here I made a deliberate mistake; there MUST be a bracket around the '-20' |
 |
(65) |
The above is merely a flavour of what you can do with Maple.
I will finish with a demonstration that :
| > |
Int(x^4*(1-x)^4/(1+x^2),x = 0 .. 1); |
 |
(66) |
| > |
int((x^4*(1 - x)^4)/(1 + x^2), x = 0..1); |
 |
(67) |
| > |
with(plots):
p1 := plot(.01, x=0..1, y = -.002..(.015), colour = black, thickness = 3):
p2 := plot((x^4*(1 - x)^4)/(1 + x^2), x=0..1, filled=true, color=red):
display([p1, p2]); |
The area of the red region is , and is greater than 0, and less than 0.01 (in fact, a good deal less).
Of course is a decent approximation to :
 |
(68) |
 |
(69) |
| > |
evalf(22/7) - evalf(Pi); |
 |
(70) |