50 likes | 165 Views
Ma 375 - Communicating Mathematics. Carl Eberhart and Paul Eakin. Class 14 More polynomials, plus procedures. We are going to spend the day investigating the remainder question posed last time. While we are at it we will learn how to add to the Maple vocabulary by
E N D
Ma 375 - Communicating Mathematics Carl Eberhart and Paul Eakin Class 14 More polynomials, plus procedures
We are going to spend the day investigating the remainder question posed last time. While we are at it we will learn how to add to the Maple vocabulary by defining new words in a worksheet.
To define a new word in a Maple worksheet : 1. Name the inputs and give them values. 2. Develop the procedure in one or more input cells using the input values you have chosen. 3. Copy the appropriate input cells into a new cell. 4. At the top of this cell, add a ‘proc line’, where you name the procedure, and show the inputs. 5. At the bottom of the cell, add a line with the word end; on it. 6. Execute the cell. If everything is ok, your definition will appear nicely formatted at the bottom. 7. Test your definition out on some values you know.
A couple of words, er, procedures 1. basic functions f := x -> sin(x^2+1); now f(4) returns sin(5) 2. A procedure to compute the nth term of the fibonaci sequence. fibo := proc(n) if n = 1 or n=2 then 1 else fibo(n-1)+fibo(n-2) fi end;now fibo(10) returns 55
Vocabulary building for j from 1 to 10 do print(j^2+sin(j)) od; seq(j^2 + sin(j),j=1..10); evalf(sin(10)); if a > 0 then a^3 else a^5 fi; lists vs expression sequences vs sets