{VERSION 5 0 "SUN SPARC SOLARIS" "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 "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {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 "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 3 0 }1 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 } {PSTYLE "Heading 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 8 2 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 3" 4 5 1 {CSTYLE "" -1 -1 "" 1 12 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE "" -1 -1 "" 0 1 0 0 255 1 0 0 0 0 0 0 1 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "M aple 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 "Title" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 0 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }} {SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT -1 37 "Fitting Data Using the Si mplex Method" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "?simplex" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 86 "Question mark command in MAPLE gi ves you a help window for the command. This is VERY " }}{PARA 0 "" 0 "" {TEXT -1 49 "useful assuming you know the name of the command." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(simplex):" }}{PARA 7 " " 1 "" {TEXT -1 87 "Warning, the protected names maximize and minimize have been redefined and unprotected\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "You must load the package simplex in order to access the \+ routines necessary to use this method." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 5 "" 0 "" {TEXT -1 17 "Sample Proble m #1" }}{PARA 0 "" 0 "" {TEXT -1 101 "Suppose we want to find the best linear fit y = mx + b to the data \{ (1,2), (2,3.5), (3,4), (4,6) \} " }}{PARA 0 "" 0 "" {TEXT -1 97 "using the Chebyshev Approximation Cr iterion (ie. minimize the largest absolute deviation between " }} {PARA 0 "" 0 "" {TEXT -1 102 "the data and the line.) The 4 absolute \+ deviations are |2 - (m + b)|, |3.5 - (2m + b)|, |4 - (3m + b)|" }} {PARA 0 "" 0 "" {TEXT -1 104 "and |6 - (4m + b)|. We want to find the values of m and b which make the largest of these 4 deviations " }} {PARA 0 "" 0 "" {TEXT -1 21 "as small as possible." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "m := 1.25: b := 1:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "r := max (abs(2 - m - b),abs(3.5 - 2*m - b),abs(4 - 3*m - b),abs(6 - 4*m - b)); " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"rG$\"#v!\"#" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 96 "The command above \"max\" is used to calculate \+ the maximum of the absolute deviations. Note that " }}{PARA 0 "" 0 " " {TEXT -1 98 "\"abs\" is the command for the absolute value. Given a particular m and b value, the above command " }}{PARA 0 "" 0 "" {TEXT -1 103 "quickly calculates the maximum absolute deviation. This is useful for checking results and estimating " }}{PARA 0 "" 0 "" {TEXT -1 10 "best fits." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 101 "This command is necessary to clear the v alues of m, b and r so you can use them as variables below. " }} {PARA 0 "" 0 "" {TEXT -1 101 "This command basically is like restartin g MAPLE. Be careful when you use it. You will need to load " }} {PARA 0 "" 0 "" {TEXT -1 41 "the simplex package again if you restart. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 101 "We \+ let r = maximum absolute deviation. We wish to minimize r subject to the constraints that each " }}{PARA 0 "" 0 "" {TEXT -1 104 "absolute \+ deviation is less than or equal to r. This is a clever way of avoidin g the calculation of the " }}{PARA 0 "" 0 "" {TEXT -1 100 "maximum dev iation. In other words, if one of the absolute deviations is bigger t han r, then that r " }}{PARA 0 "" 0 "" {TEXT -1 76 "is inadmissible be cause r is supposed to be the largest of the deviations. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 100 "There will be 4 \+ constraints in this case, which after removing the absolute value lead s to 8 linear " }}{PARA 0 "" 0 "" {TEXT -1 107 "constraints. For exam ple, |2 - m - b| <= r can be written as the two inequalities r - 2 \+ + m + b >= 0 " }}{PARA 0 "" 0 "" {TEXT -1 106 "and r + 2 - m - b >= \+ 0. Both of these must be satisfied simultaneously. We list the 8 con straints below:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 126 "cnsts : = \{r+m+b >= 2, r-m-b >= -2, r+2*m+b >= 3.5, r-2*m-b >= -3.5, r+3*m+b \+ >= 4, r-3*m-b >= -4, r+4*m+b >= 6, r-4*m-b >= -6\};" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%&cnstsG<*1\"\"#,(%\"rG\"\"\"%\"mGF*%\"bGF*1!\"#,(F) F*F+!\"\"F,F01$\"#NF0,(F)F**&F'F*F+F*F*F,F*1$!#NF0,(F)F**&F'F*F+F*F0F, F01\"\"%,(F)F**&\"\"$F*F+F*F*F,F*1!\"%,(F)F**&F?F*F+F*F0F,F01\"\"',(F) F**&F " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "obj := r;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$objG%\"rG" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "The objective function is simply r, which we want to minimize." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "minimize(obj,cnsts);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#<%/%\"rG$\"++++]P!#5/%\"mG$\"++++]7!\"*/%\"bG$\" ++++]iF(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 99 "Thus we see that a slope of m = 1.25 and \+ a y-int. of b = 0.625 will give us the best fit using the " }}{PARA 0 "" 0 "" {TEXT -1 95 "Chebyshev criterion. In this case the maximum ab solute deviation is only 0.375. Now that you " }}{PARA 0 "" 0 "" {TEXT -1 96 "have an answer, you can go back above and plug in values \+ near these m and b values and see that " }}{PARA 0 "" 0 "" {TEXT -1 44 "the maximum deviation does in fact increase." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 5 "" 0 "" {TEXT -1 28 "Textbook Example pp. 108-109 " }}{PARA 0 "" 0 "" {TEXT -1 108 "Here we use the constraints and vari ables from the textbook example and obtain the answer given in the tex t." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 98 "cnsts := \{r-x1+13 >= 0, r+x1-13 >= 0, r-x2+7 >= 0, r+x2-7 >= 0, r-x1-x2+19 >= 0, r+x1+x2-19 >= 0\};" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%&cnstsG<(1\"\"!,(%\"rG\"\"\"%#x1G!\"\"\"#8F*1F ',(F)F*F+F*F-F,1F',(F)F*%#x2GF,\"\"(F*1F',(F)F*F2F*F3F,1F',*F)F*F+F,F2 F,\"#>F*1F',*F)F*F+F*F2F*F8F," }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "obj := r;" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%$objG%\"rG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "minimize(obj,cnsts,NONNEGATIVE);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<%/%#x2G#\"#?\"\"$/%#x1G#\"#QF(/%\"rG#\"\"\"F(" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 136 "The option NONNEGATIVE is used to restrict the variables to being positive, which according to the exam ple in question is the case here." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 5 "" 0 "" {TEXT -1 17 "Classroom Example" }}{PARA 0 "" 0 "" {TEXT -1 93 "Here is the example presented in class about fitting a line of the form y = mx to the points " }}{PARA 0 "" 0 "" {TEXT -1 98 "(1,0), (2,3), (3,6). For this problem, it is straight-forward to \+ see geometrically that the best " }}{PARA 0 "" 0 "" {TEXT -1 24 "slope should be m = 3/2." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 91 "cnsts := \{r + m >= 0, r - m >=0, r + 2*m >= 3, r - 2*m >= -3, r + 3*m >= 6, r - 3*m >= -6\};" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&cnstsG<(1\"\"!,&%\"rG\"\"\"%\"mGF*1F',&F)F*F+!\" \"1\"\"$,&F)F**&\"\"#F*F+F*F*1!\"$,&F)F**&F3F*F+F*F.1\"\"',&F)F**&F0F* F+F*F*1!\"',&F)F**&F0F*F+F*F." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "obj := r;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$objG%\"rG" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "minimize(obj,cnsts);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#<$/%\"rG#\"\"$\"\"#/%\"mGF&" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 9 "m := 1.5:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "max( abs(-m),abs(3-2*m),abs(6-3*m));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"#:!\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "Our answer agrees with what we know to be true from \+ the geometry of the problem." }}}}{MARK "31 1 0" 78 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }