{VERSION 5 0 "IBM INTEL NT" "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 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Tim es" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 } {PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 11 12 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "N ormal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT 256 25 "Special Packages in Map le" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 106 "Ma ple has a number of useful packages that perform specialized operation s. These must be invoked with the " }{TEXT 257 4 "with" }{TEXT -1 490 " command. We have used the linear algebra, plotting, differential equ ation special tools, and statistics packages in some of the earlier le ctures. This lecture will reexamine the statistics package, then show \+ the student and finance packages. Most of these packages are quite lim ited for somebody who is working extensively in the field, but they do provide some of the standard operations in the area. Students are enc ouraged to explore some of the other packages to see what Maple can do ." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT 258 18 "Statistics Package" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 527 "Maple is probably not the best method for doing a statistical ana lysis, but it does have some statistical routines that can prove usefu l when you need some basic statistical operations or visualization of \+ certain ideas. Its strength comes in dealing with probability function s because of its integration techniques. Below we demonstrate an numbe r of the ideas from the text Chapter 22. The listing below shows a var iety of operations that can be readily performed by Maple. It certainl y covers most of the basics in statistics." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "with(stats);with(s tats[describe]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 307 "The stats pa ckage is subdivided into a series of other packages, such as anova, de scribe, statplots, etc. Above shows all the functions (basic stats fun ctions) in describe and invokes it. We begin by entering a simple list of scores that we want to examine. Many of the commands are pretty se lf-explanatory." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 178 "S := [8 7,96,73,95,50,64,73,57,94,59,61,84,94,72,78,83,97,92,79,86,85,64,50,67 ,95,85,52,72,57,67,16,64,39,76,86,37,72,86,37,72,69,45,53,82,90,57,73, 28,89,64,42,77,54,44,31,54,69];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "-sort(-S);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "xbar \+ := mean(S); evalf(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "xm ean := median(S);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "xmode \+ := mode(S);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 71 "var := varia nce(S); evalf(%); \nsdev := standarddeviation(S); evalf(%); " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "with(stats[statplots]):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 186 "data := [ Weight(10..20, 1) , Weight(20..30, 1), Weight(30..40, 4), Weight(40..50, 3), Weight(50.. 60, 10), Weight(60..70, 9), Weight(70..80, 11), Weight(80..90, 10), We ight(90..100, 8)]:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "his togram(data, color=magenta);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 76 "S uppose we want to examine some probability distributions. These are in the " }{TEXT 263 10 "statevalf " }{TEXT -1 11 "subpackage." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "with(stats[statevalf]);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "Digits := 5:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Create the binomial probability function. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "f := seq(statevalf[pf, \+ binomiald[5, 0.55]](x), x = 0..5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "Create the binomial distribution function." }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 59 "F := seq(statevalf[dcdf, binomiald[5, 0.55]] (x), x = 0..5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "s := seq ([[j-1,0],[j-1,f[j]]], j = 1..6);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "plot(\{s\},x=0..6, color=BLUE);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "x := 'x':" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 98 "G := x -> piecewise(x < 0, 0, x < 1, F[1], x < 2, F[2 ], x < 3, F[3], x < 4, F[4], x < 5, F[5], 1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "plot(G(x),x=0..10, P = 0..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 101 "Let us graph the probability function for the \+ Normal distribution and view the distribution function." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "plot(statevalf[pdf,normald[0,1]](x) ,x = -4..4);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "plot(statev alf[cdf,normald[0,1]](x),x = -4..4);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "f := x -> (1/sqrt(2*Pi))*exp(-x^2/2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "int(f(x), x = -infinity..2);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "statevalf[cdf,normald[0,1]](2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "Here we generate some random numbers, suc h as might be used in a Monte Carlo simulation." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "rn := rand( 1..50):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "RN := [seq(rn(j) ,j = 1..15)];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "evalf(mean (RN));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "evalf(standarddev iation(RN));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "Here we perform s ome statistics on the list of student scores given above." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "S;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "We find confidence intervals (say 95%)." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 23 "xbar := evalf(mean(S));" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 26 "var := evalf(variance(S));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "sqvar := sqrt(var);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 52 "conf1 := statevalf[icdf, normald[xbar,sqvar]]( 0.05);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "conf2 := stateval f[icdf, normald[xbar,sqvar]](0.95);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 211 "Thus, we should see 90% of the exam scores between 36 and 99, \+ if I'm interpretting this statistical analysis correctly. Since 3 of 5 4 scores lie outside the 90% confidence level, this seems to agree pre tty well." }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT 264 15 "Sorting Routine" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "The commands and program below all ow the easy sorting and analysis of" }}{PARA 0 "" 0 "" {TEXT -1 14 "a \+ set of data." }}{PARA 12 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 21 "Create a data matrix." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "A:=matrix(5,3,[a,12,34,b,32,54,c,24,45,d,33,42,e,21,60]);" }} {PARA 11 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 75 " Below we create a program for sorting the data based on a particular c olumn" }}{PARA 0 "" 0 "" {TEXT -1 19 "in ascending order." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "sort col := proc(A,N)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "local i,j,n;" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "n := rowdim(A);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "for j from 1 to n-2 do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "for i from 1 to n-1 do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "if A[i,N] > A[i+1,N] then" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "A := swaprow(A,i,i+1);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "fi:" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "od:od:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalm(A);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "end:" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "Use the routine for sorting colu mns 2 and 3." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "sortcol(A,2);" }}{PARA 11 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "sortcol(A,3);" }}{PARA 11 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Comput e the average of the second column." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(stats):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "A2 := col(A,2);" }}{PARA 11 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "A2 := convert(A2,list);" }}{PARA 11 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 " describe[mean](A2); evalf(%);" }}{PARA 11 "" 1 "" {TEXT -1 0 "" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT 259 15 "Student Package" }}{PARA 0 "" 0 "" {TEXT -1 225 "The student package \+ is a collection of special tools to help visualize and understand a fe w of the concepts in Calculus. I find that Maple's student package pro vides an excellent tool to help students appreciate Riemann sums." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(student);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "f := \+ x -> x^3-6*x^2+9*x+2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "The stud ent package makes it easy to view a tangent line." }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 29 "showtangent(f(x),x=4,x=0..5);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT 261 12 "Riemann Sums" }}{PARA 0 "" 0 "" {TEXT -1 158 "The next series of commands allow one to see the formulae and \+ the geometric interpretation of the Riemann sums as they converge to t he value of the integral. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "middlesum(f(x),x=0..5,5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "middlebox (f(x),x=0..5,5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "middles um(f(x),x=0..5,10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf (%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 26 "middlebox(f(x),x=0..5,10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "middlesum(f(x),x=0..5,20);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "middlebox(f(x), x=0..5,20);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "middlesum(f( x),x=0..5,40);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "middlebox(f(x),x=0..5,40);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "int(f(x),x=0..5);evalf(%);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 17 "Int(f(x),x=0..5);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT 260 15 "Finance Package" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(finance);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 275 "The finance package has a number of usef ul routines that simplify some calculations. The programs are limited, but do provide some tools. Below we demonstrate a couple of the comma nds in this area. Certainly the Maple Help will provide a much better \+ idea of what can be done." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 4 "The " }{TEXT 262 12 "amortization" }{TEXT -1 256 " \+ command can do a variety of things. The simplest example is producing \+ an amortization table for say paying off a credit card. Suppose you ha ve a debt of $3000 at and annual interest rate of 12%. If you can pay \+ $100/month, then how much does this cost you." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "amortization( 3000.00, 100, 0.12/12);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "This shows it will take you 3 year s to pay off the loan at a cost of $584.62 to you. " }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 381 "The amortization funct ion allows other operations, which can be viewed in Help. Next we cons ider the yieldtomaturity function. Suppose I hold a bond with face val ue of 1000 U with an annual coupon rate of 12%. The coupon is paid twi ce yearly. The maturity is in 3 years. What is the yield to maturity o f the bond, compounded semi-annually given that its present value is 1 050.75 U " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "yieldtomaturit y( 1050.75, 1000, 0.12/2, 6 );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "Yield is 5% per half year, therefore it is " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "%*2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "10% \+ per year." }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "1" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }