{VERSION 5 0 "IBM INTEL LINUX" "5.0" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0
1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }
{CSTYLE "" -1 257 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal
" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0
-1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1
"" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }}
{SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{SECT 1
{PARA 3 "" 0 "" {TEXT -1 25 "Sets, Lists, some basics." }}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 60 "A set is denoted by \{\} and a list by []
. Both may be empty." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "S1:= \{\}; S2 := \{1, 23\}; S3 := \+
\{23,4,5\};" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "Union, intersecti
on and minus (set difference) can be accomplished two ways. Notice th
e back quote. The second form is more compact for more than two sets.
" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 49 "T1 := S2 union S3; T2 := `intersect`(S2, S3,T1);" }}
}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "You can test for membership and t
he result is of type boolean." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 40 "b := member(1, S1); c := member(1, S2);" }}}{EXCHG {PARA 0 ">
" 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16
"type(b,boolean);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "b and c
;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 5 "Lists" }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 41 "L1 := [2,3,5,2,3,6,2,3]; L2 := [3,4,8,9];" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "nops(L1); op(3,L1); [op(1..
6,L1)]; \{op(1..6,L1)\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16
"convert(L1,set);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "L3 := \+
[op(L1),op(L2)];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "L3 := m
ap(x -> x^2, L2);" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 26 "The Linear
Algebra Package" }}{PARA 0 "" 0 "" {TEXT -1 92 "Maple 6 has two packa
ges for doing linear algebra-- LinearAlgebra, which is new, and linalg
." }}{PARA 0 "" 0 "" {TEXT -1 248 "The new package improves on the ol
der linalg package in many ways. We'll look at some of the features o
f the new package. A fundamental difference is that Vectors and Matr
ices are stored as rtables rather than tables. This means that access
ing" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 168 "F
irst, defining a Vector or Matrix can be done in very many ways (note \+
the capital letter means Maple will use Linear Algebra not linalg). W
e'll just look at a couple." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA
0 "" 0 "" {TEXT -1 64 "Specifying just the dimension gives you an obje
ct with all 0's,." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "Vector(
2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "You can also specify the e
ntries in several ways:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "
A:= Vector(1..3, 5); A[2];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
38 "f:= (j) -> x^(j-1); Vector(3,f);" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 35 "g:= k -> k*(k-1); Vector(3,g);" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 221 "There is an option to specify a row Vect
or. The example also shows two other things 1) you can just spell ou
t the entries, you don't have to say the dimensions, 2) your entries \+
can be numbers, variables, and functions." }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 28 "C := Vector[row]([3,x^2,g]);" }}}{EXCHG {PARA 0 ""
0 "" {TEXT -1 195 "The default for a random Vector is integer entries \+
between -99 and 99. You can also specify a random number generator. \+
There are other options too: e.g. specify the density, specify the sh
ape." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "RanVec := LinearAlg
ebra[RandomVector];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "B :=
RanVec(3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "rn := rand(1
..10^6);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "RanVec(10, gene
rator = rn, density = .5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 67 "Ari
thmetic operations are easy to write. Recall our Vectors A, B.." }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 13 "A; B; A+5*B; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "Matrtix mu
ltiplications is also easy (and the LinearAlgebra package is not requi
red)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "C; A.C;" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 65 "If you want to apply a function to
each term use the map command." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 13 "map(exp, A); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "For Matr
ices the same techniques apply. " }}{PARA 0 "" 0 "" {TEXT -1 88 "Addi
tional constructors for matrices are Identity Matrix, ScalarMatrix, D
iagonalMatrix," }}{PARA 0 "" 0 "" {TEXT -1 27 "BandMatrix and many oth
ers." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 44 "M := LinearAlgebra[DiagonalMatrix]([5,3,4]);" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT
-1 69 "Multiplication of a Matrix and Vector and Matrix inversion are \+
easy: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "M.A; M^(-1);" }}
}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 32 "L
et's get the whole package now." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 20 "with(LinearAlgebra);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "Y
ou can specify the entries of a Matrix as follows:" }}{PARA 0 "" 0 "
" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "N := <<2,
3,4>|<1,2,3>|<5,0,7>>;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "Just to
prove there is a difference between matrix and Matrix." }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "type(M,matrix); type(M,Matrix);" }}
}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Now, to solve a system." }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 17 "LinearSolve(N,A);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT
-1 22 "New Matrices from old:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "P := ; Q := ;" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "Solving the following linear syst
em gives a three dimensional space." }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 17 "LinearSolve(Q,A);" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 55 "Q.<1,0,0,4,-5,0>; Q.<0,1,0,5,-6,0>; Q.<0,0,1,5,-5,-1
>;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 111 "Eigenvectors gives you a v
ector with the Eigenvalues, followed by a matrix with the correspondin
g Eigenvectors." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "H := eva
lf(Eigenvectors(N));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "H[1]
;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 96 "To select the Eigenvector, s
elect the second element of the list H then select the first column."
}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "K := H[2];" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "K[1..3,1];" }}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 33 "h:=CharacteristicPolynomial(N,x);" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "solve(h,x);" }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 21 "plots[matrixplot](P);" }}}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 23 "Basic
s of Number Theory" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "
" 0 "" {TEXT -1 68 "The starting point is primes. There are several w
ays to get primes." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "nextp
rime(100);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "ithprime(55);
" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "isprime(%);" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 175 "The Euclidean algeorithm is used to find
the greatest common divisor. You can get the quotient of each intege
r by the gcd. The two extra variables are set to these values." }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "gcd(27,18);" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "gcd(27,18,'ap','bp');ap; bp;" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "You can also get the linear combin
ation that gives the gcd.." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "igcdex(45,290,'s','t');" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "s; t; s*45 + t*290;" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 78 "The same can be done with polynomials. Y
ou have to specify the variable, too." }}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "F := x^3-3*x-2; H := x^
4-4*x^2-x+2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "gcdex(F, H,
x, 's','t');" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "s; t; s*F
+ t*H; simplify(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 245 "A numbe
r of functions have two versions, one for polynomials and one for inte
gers. The integer version is preceeded with i (e.g. gcd). Other func
tions have both real number and integer versions. Again, the integer \+
version is preceeded with i." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "ifactor(1351895612498);" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 99 "In ifactors(), the first term is \+
-1 if the input is negative. The other terms are [prime ,power]." }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "ifactors(120);" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 158 "The q is optional and it receives the qu
otient. iquo works the other way returning the quotient, and (optiona
lly) setting an input variable to the remainder." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "irem(29,7,'
q'); q;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "You can solve equatio
ns for integer solutions." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "isolve(3*u-4*v=7);" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}
{SECT 0 {PARA 3 "" 0 "" {TEXT -1 14 " Two Exercises" }}{PARA 0 "" 0 "
" {TEXT -1 212 "1. Make a list of all (less than some bound) the Fibo
nacci numbers which are also perfect squares. List also the index of \+
the Fibonacci number. Try it by a brute force method and then try to \+
be more efficient." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 48 "2. Which Fibonacci numbers are divisible by 17?" }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 256 0 "" }{TEXT 257 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "4 23 0 0" 18 }
{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }