{VERSION 3 0 "IBM INTEL NT" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 0 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 261 "" 0 1 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 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 265 "" 1 24 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 266 "" 1 24 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 269 "" 0 10 0 0 0 0 1 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 271 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 272 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 273 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 274 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 275 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 276 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 277 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 278 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 279 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 280 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 281 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 282 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 283 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 284 "" 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 285 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 286 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 287 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 288 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 289 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 290 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 0 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" 0 0 0 0 255 1 0 0 0 0 0 1 3 0 3 }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 }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 -1 8 2 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 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE " " -1 -1 "" 0 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 "Maple Plot" 0 13 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Fixed Width" 0 17 1 {CSTYLE "" -1 -1 "Courier" 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 17 0 }{PSTYLE "Title" 0 18 1 {CSTYLE "" -1 -1 " " 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 } {PSTYLE "" 17 256 1 {CSTYLE "" -1 -1 "" 0 1 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 }} {SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT 267 10 "Lession 1 " }{TEXT 266 0 "" }{TEXT 265 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 30 "Chapter 0 : The Basics of Maple" }}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 37 "Section \+ 0.1: An Introduction to Maple" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 516 "Maple is a powerful mathematical \+ software package which you will be required to use during this course. This document is an introduction to some of the Maple elements which \+ you should be able to use through the end of Section 2.1 in your textb ook. I will provide additional supplements to this introduction as the course progresses. The character '>' which appears on the line below \+ this paragraph is known as a prompt. All Maple commands used as exampl es below will be given on separate lines, preceded by a prompt." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 185 "The first thing you should know about Maple is the '?' c ommand. This will call up a help screen for the command whose name you type immediately following the question mark. For example," }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "?p lot3d" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 50 "will open a window which tells you how to use the " } {TEXT 268 6 "plot3d" }{TEXT -1 207 " command. This help tool will be i nvaluable! You can also access an index of help topics through the Hel p menu at the top of the screen.\n\nThe second most important thing to know is that all other commands " }{TEXT 269 4 "must" }{TEXT -1 205 " be followed by either a colon (:) or a semicolon (;). The semico lon instructs Maple to display the output, while the colon instructs M aple to surpress the output. You should almost always use a semicolon. " }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 28 "Section 0.2: The Very Basics" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "Arithmetic operations:" }}{PARA 256 "" 0 "" {TEXT -1 14 " + addition" }}{PARA 17 "" 0 "" {TEXT -1 17 " - subtraction" }}{PARA 17 "" 0 "" {TEXT -1 20 " * multiplic ation" }}{PARA 17 "" 0 "" {TEXT -1 14 " / division" }}{PARA 17 "" 0 "" {TEXT -1 20 " ^ exponentiation" }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 79 "In order to make assignments (e.g., t o set constants or define functions), use " }{TEXT 256 2 ":=" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 12 "For example," }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "a := 3;" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 35 " will set the constant a equal to 3." }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "b := 2*Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 34 "Pi is a b uilt in constant, and it " }{TEXT 257 4 "must" }{TEXT -1 147 " be capi talized as it is above. Also note that you must insert the * between a ny coefficient and variable. For example, 2x would be entered as 2*x. " }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 32 "Section 0.3: Intrinsic Functions" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 137 "There are several pre-define d functions built into Maple. Some of these (particularly those which \+ you may have some call to use) include:" }}{PARA 17 "" 0 "" {TEXT -1 31 " sqrt(x) - square root of x" }}{PARA 17 "" 0 "" {TEXT -1 34 " \+ abs(x) - absolute value of x" }}{PARA 17 "" 0 "" {TEXT -1 26 " \+ cos(x) - cosine of x" }}{PARA 17 "" 0 "" {TEXT -1 34 " arccos(x) \+ - inverse cosine of x" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 91 "Examples of these, along with Maple's output. Note tha t the output is centered on the page." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "sqrt(8);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$*$-%%sqrtG6#\"\"#\"\"\"F(" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 11 "arccos(-1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #%#PiG" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 69 "For a complete list of these built-in functions, use the \+ help command" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "?inifcns" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {SECT 0 {PARA 4 "" 0 "" {TEXT -1 44 "Section 0.4: Defining and Plottin g Functions" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 327 "There are actually several methods of defining functions , but for simplicity we will use only one of them. The best way to ill ustrate this method is simply by example. Let's define a function whic h takes the radius of a circle as its input and returns the area of th e circle as its output. The following command does just that:" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "A := r -> Pi * r^2;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AGR6# %\"rG6\"6$%)operatorG%&arrowGF(*&%#PiG\"\"\")9$\"\"#\"\"\"F(F(F(" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 267 "H ere we have named our area function A, and the input variable is r. Th e thing that looks like an arrow is actually just a dash (-) followed \+ by a greater than symbol (>). Now, if you wanted to find the area of a circle of radius 4/3, you simply evaluate the function:" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "A(4/3 );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$%#PiG#\"#;\"\"*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 39 "Note that Maple returns the area as an " }{TEXT 258 5 "exact" }{TEXT -1 100 " a nswer, rather than as a decimal. In order to obtain a decimal approxim ation to this area, use the " }{TEXT 259 5 "evalf" }{TEXT -1 10 " func tion:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"+3O0&e &!\"*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 44 "Using the percent symbol as the argument of " }{TEXT 260 5 "evalf" }{TEXT -1 90 " tells Maple to turn the previous output into \+ a decimal. Since the area we wanted to know " }{TEXT 261 3 "was" } {TEXT -1 148 " that previous output, the percent symbol served as a sh ortcut. We could have obtained the same result by using the symbolic a nswer as our argument:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "evalf(16*Pi/9);" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#$\"+3O0&e&!\"*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 64 "If we wished to view a graph of this function, we could use the " }{TEXT 262 4 "plot" }{TEXT -1 9 " comman d:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "plot(A(r),r=0..2);" }}{PARA 13 "" 1 "" {GLPLOT2D 400 300 300 {PLOTDATA 2 "6%-%'CURVESG6$7S7$\"\"!F(7$$\"1LLLL3VfV!#<$\"1'G= #eG[qf!#=7$$\"1nmm\"H[D:)F,$\"1LH_7&H!)3#F,7$$\"1LLLe0$=C\"!#;$\"12yhX byW[F,7$$\"1LLL3RBr;F8$\"148`N)RXx)F,7$$\"1mm;zjf)4#F8$\"1!4<^%4f$Q\"F 87$$\"1LL$e4;[\\#F8$\"1w)GK*4Ob>F87$$\"1++]i'y]!HF8$\"1pTAw9M^EF87$$\" 1LL$ezs$HLF8$\"1;K],&oB[$F87$$\"1++]7iI_PF8$\"1$)))=D-IBWF87$$\"1nmm;_ M(=%F8$\"1GL0lXU3bF87$$\"1LLL3y_qXF8$\"1e>u&[+Fc'F87$$\"1+++]1!>+&F8$ \"1\"eUp$Q&*fyF87$$\"1+++]Z/NaF8$\"1n&zJ/u,G*F87$$\"1+++]$fC&eF8$\"1o. <5d.w5!#:7$$\"1LL$ez6:B'F8$\"1$)Q!z1N*>7F\\p7$$\"1mmm;=C#o'F8$\"1dJ@E^ z-9F\\p7$$\"1mmmm#pS1(F8$\"1O*HQ\\)on:F\\p7$$\"1++]i`A3vF8$\"1K\"**Q5C 5x\"F\\p7$$\"1mmmm(y8!zF8$\"1)[(\\:CNh>F\\p7$$\"1++]i.tK$)F8$\"1m[iheM \"=#F\\p7$$\"1++](3zMu)F8$\"158R_\")p,CF\\p7$$\"1nmm\"H_?<*F8$\"1D/=-L \"Hk#F\\p7$$\"1nm;zihl&*F8$\"1D]#*e\"*euGF\\p7$$\"1LLL3#G,***F8$\"1e%F\\p7$$\"1++Dcp@[7F\\ p$\"1fYX%R\\'yF\\p7$$\"1++D1*3`i\"F\\p$\"1@V)yQA*) H)F\\p7$$\"1LLL$*zym;F\\p$\"1v')4Oo\"zs)F\\p7$$\"1LL$3N1#4nY_]8N'*F\\p7$$\"1+++q(G**y\"F\\p $\"1^)\\?fF\\p$\"1.n;9XU`6F^y7$$\"1++v.Uac>F\\p$ \"1grkd@i-7F^y7$$\"\"#F($\"1 " 0 "" {MPLTEXT 1 0 18 "plot(f(x),x=a..b) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 255 "f(x) can be either a function which has already been defined or a n algebraic expression. a and b are the leftmost and rightmost values \+ of the independent variable to appear on the graph. Maple will select \+ an appropriate range of y values. There is also a " }{TEXT 264 6 "plot 3d" }{TEXT -1 55 " command for functions of two variables. As an examp le," }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "plot3d(sin(x+y),x=-Pi..Pi,y=-Pi..Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 197 "I have n ot included the graph on the printout of this document. As you hopeful ly will not have to learn, printing 3D plots consumes a lot of time an d memory and is generally not worth the trouble. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 258 "This is all that I will \+ say about functions and their graphs. Because we will not often be dea ling with explicit functions, there will be a much more efficient way \+ for us to plot graphs of linear equations. We will discuss this in mor e detail in Section 2.1." }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 34 "Chapter 1: Introduction to Vectors" }} {SECT 0 {PARA 4 "" 0 "" {TEXT -1 44 "Section 1.1: Vectors and Linear C ombinations" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "Most of the linear algebra commands and functions that we will use are a part of Maple's " }{TEXT 270 6 "linalg" }{TEXT -1 221 " package, but they must first be loaded into Maple's memory. Since we will be using these quite often, I suggest that you load this package at the beginning of each of your Maple sessions. You load this packag e using the " }{TEXT 271 4 "with" }{TEXT -1 9 " command:" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with (linalg):" }}{PARA 7 "" 1 "" {TEXT -1 32 "Warning, new definition for \+ norm" }}{PARA 7 "" 1 "" {TEXT -1 33 "Warning, new definition for trace " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 321 "Note that I used the colon here. With a semicolon, you'll get a l ist of the commands and functions included with this package. There ar e more than a hundred functions in the package, so I doubt you'll want that complete list every time you load the package. Besides, you can \+ always look at the complete list by using the " }{TEXT 272 7 "?linalg " }{TEXT -1 85 " command. Also, don't worry about the two warnings, as they are just indicating that " }{TEXT 275 4 "norm" }{TEXT -1 5 " and " }{TEXT 276 5 "trace" }{TEXT -1 86 " will now mean what we want them to mean. We'll explore the use of quite a few of the " }{TEXT 273 6 " linalg" }{TEXT -1 43 " functions over the course of the semester." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 85 "Now that \+ these functions are defined, how do we go about creating a vector? Wit h the " }{TEXT 274 6 "vector" }{TEXT -1 21 " function, of course!" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "vector([x1, ..., xn]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 347 "This command creates an n-dimensional \+ column vector with x1 through xn as its components. Note that Maple wi ll always represent vectors in the \"lying on their side\" form that w e have discussed in class, but computation will always assume that the vector is a column vector. As an example, let's define the vectors i, j, and k for three dimensions:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 65 "i := vector([1,0,0]);\nj := \+ vector([0,1,0]);\nk := vector([0,0,1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"iG-%'vectorG6#7%\"\"\"\"\"!F*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"jG-%'vectorG6#7%\"\"!\"\"\"F)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"kG-%'vectorG6#7%\"\"!F)\"\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 196 "Note how I executed thre e separate mathematical statements at once. To move to the beginning o f a new line without executing the current line, hold down the shift k ey while pressing the enter key." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 135 "One other thing you mish wish to do from time to time is have Maple pick a vector for you at random. This can \+ be accomplished with the " }{TEXT 277 10 "randvector" }{TEXT -1 10 " f unction:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "randvector(n);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 126 "This will create a random vector of dimension n. By default, the components of the vector will be integer s between -99 and 99." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "r1 := randvector(3);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%#r1G-%'vectorG6#7%!#&)!#b!#P" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "r2 := randvector(3);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#r2G-%'vectorG6#7%!#N\"#(*\"#]" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 108 "For more informatio n on random vectors, or on Maple's random number generator, use the bu ilt-in help system." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 217 "Now that we know how to create vectors, how do we perf orm vector arithmetic? In particular, we need to be able to create lin ear combinations of the vectors we have created. This is accomplished \+ through the use of the " }{TEXT 278 5 "evalm" }{TEXT -1 15 " function. The " }{TEXT 279 5 "evalm" }{TEXT -1 196 " function is technically ho w Maple performs arithmetic -- including addition, scalar multiplicati on, and multiplication -- on matrices, but since a vector is simply a \+ matrix with only one column, " }{TEXT 280 5 "evalm" }{TEXT -1 184 " al so applies to vectors. The standard arithmetic operators apply, with + and - indicating vector addition and subtraction, and with * indicati ng scalar multiplication. A few examples:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalm(r1+r2);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#-%'vectorG6#7%!$?\"\"#U\"#8" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "evalm(2*i-3*j+k);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'vectorG6#7%\"\"#!\"$\"\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "evalm(4*% + 8*j);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'vectorG6#7%\"\")!\"%\"\"%" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 163 "And that's all ther e is to it! Once again, please keep in mind that these answers are all column vectors -- they are just written on their sides to conserve sp ace." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 " " }}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 37 "Section 1.2: Lengths and Dot Products" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 215 "In this section, we learned how to compute the dot produ ct of two vectors, the norm of a vector, and the angle between two vec tors. All of these quantities can be computed rather easily using func tions found in the " }{TEXT 281 6 "linalg" }{TEXT -1 90 " package. Fir st, the dot product. If u and v are two vectors with the same dimensio n, then" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "?dotprod;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "dotprod(u,v);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 94 "computes the dot product of u and v. For an exampl e, we first create two vectors and then use " }{TEXT 282 7 "dotprod" } {TEXT -1 30 " to compute their dot product." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "u := vector([1,2, 3,4,5]);\nv := vector([-5,-4,3,2,1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"uG-%'vectorG6#7'\"\"\"\"\"#\"\"$\"\"%\"\"&" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"vG-%'vectorG6#7'!\"&!\"%\"\"$\"\"#\"\"\"" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "dotprod(u,v);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#\"\"*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 350 "Computing the norm of a vector is sligh tly more tricky. As we may discuss later in the course, there are seve ral different ways to define a vector norm. The one which we have alre ady discussed (the square root of the sum of the squares of the compon ents) is technically called the 2-norm of a vector. To distinguish bet ween several common norms, the " }{TEXT 283 4 "norm" }{TEXT -1 232 " f unction uses a second argument to specify the norm to be used. In our \+ case, this argument will always be 2. Therefore, in order for us to co mpute the norm (the 2-norm, to be precise) of a vector, we must use th e following command:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "norm(u,2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 107 "This computes the norm o f the vector u. As an example to illustrate the use, consider the foll owing vector." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "u := vector([1,1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"uG-%'vectorG6#7$\"\"\"F)" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 126 "We can easily compute \+ that the norm of this vector, as we have defined it, is the square roo t of 2. Now let Maple do the work:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "norm(u,2);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*$-%%sqrtG6#\"\"#\"\"\"" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 6 "It is " }{TEXT 284 10 "i mperative" }{TEXT -1 130 " that you remember to include the 2 as a sec ond argument in the function. If you do not, your answer will be wrong ! To illustrate," }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "norm(u);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\" \"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 404 "This is not the correct answer, at least not for how we have d efined the norm. Always make certain that the 2 is a part of your comm and. Just one more thing you should note before we move on to the angl e between two vectors. If you will recall, we defined the norm of a ve ctor as the square root of the dot product of the vector with itself. \+ Thus, if you for some reason did not want to use the built-in " } {TEXT 285 4 "norm" }{TEXT -1 70 " function, you could always compute n orms according to the definition:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "sqrt(dotprod(u,u));" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#*$-%%sqrtG6#\"\"#\"\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 256 "Now, hav ing learned how to compute dot products and norms, we can turn to the \+ question of computing the angle between two vectors. From the Cosine F ormula (page 15 of your textbook), we know that the angle between vect ors u and v can be compute as follows:" }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "arccos( dotprod(u,v)/(n orm(u,2)*norm(v,2)) );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 84 "This, however, would be cumbersome to typ e in over and over again. Fortunately, the " }{TEXT 286 6 "linalg" } {TEXT -1 60 " package once again comes to our rescue, this time with t he " }{TEXT 287 5 "angle" }{TEXT -1 10 " function:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "angle(u,v); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 106 "This function performs exactly the same computation as the length ier formula above. A few examples follow." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "i := vector([1,0,0]) ;\nj := vector([0,1,0]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"iG-%'v ectorG6#7%\"\"\"\"\"!F*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"jG-%'ve ctorG6#7%\"\"!\"\"\"F)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "a ngle(i,j);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$%#PiG#\"\"\"\"\"#" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "u := vector([1,0,1]);\nv := \+ vector([-1,1,0]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"uG-%'vectorG6 #7%\"\"\"\"\"!F)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"vG-%'vectorG6# 7%!\"\"\"\"\"\"\"!" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "angle (u,v);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$%#PiG#\"\"#\"\"$" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 169 "O ne final note. We have also talked about normalizing vectors; that is, given a vector u, we can find a unit vector in the same direction by \+ dividing u by its norm. The " }{TEXT 288 6 "linalg" }{TEXT -1 61 " pac kage also provides a built-in function for this purpose, " }{TEXT 289 9 "normalize" }{TEXT -1 81 ". Notice that the vectors u and v in the a bove example are not unit vectors. Use " }{TEXT 290 9 "normalize" } {TEXT -1 1 ":" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "U := normalize(u);\nV := normalize(v);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"UG-%'vectorG6#7%,$*$-%%sqrtG6#\"\"#\"\" \"#\"\"\"F.\"\"!F)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"VG-%'vectorG 6#7%,$*$-%%sqrtG6#\"\"#\"\"\"#!\"\"F.,$F*#\"\"\"F.\"\"!" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 144 "Note tha t since U and V are in the same directions as u and v, respectively, t he angle between U and V is the same as the angle between u and v:" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "angle(U,V);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$%#PiG#\"\"#\"\" $" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 186 "That covers each of the main topics from Section 1.2. Should you \+ wish to practice on some examples, I suggest taking a look at the firs t three problems from Section 1.2 of your textbook." }}}{PARA 0 "" 1 " " {TEXT -1 0 "" }}}}}{MARK "2 2 4 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }