{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 "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 } {CSTYLE "" -1 256 "" 1 24 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "" 1 24 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 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 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }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 1 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT 257 36 "Computer Algebra, week 1, lecture 2:" }}{PARA 0 "" 0 "" {TEXT 256 63 "Operations with polynomia ls and the use of quotes ' ' in Maple." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 44 "Let F be some polynomial in x, for ex ample: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 81 "restart; # This command un-assigns all variables, as if you had restarted Maple." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "F:=x^5+x+1;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"FG,(*$)%\"xG\"\"&\"\"\"F*F(F*F*F*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 193 "When we assigned F, the variable x had n ot yet been assigned. If x had been assigned, for example if x had the value 1, then F wouldn't have been what it is now, but would have had the value 3." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=1;" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"xG\"\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"$" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 385 "However, we did not first assign \+ x and then F, but first F and then x. That makes a difference, because even though F now looks like 3, it really is still x^5+x+1 which just happens to evaluate to 3 but is not quite the same thing as 3. This b ecomes visible if you change x. Changing x will have no impact on 3, b ut will have an impact on F, and thus F is not completely the same as \+ 3." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "x:=12;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"xG\"#7" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"'X)[#" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=y;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#> %\"xG%\"yG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,(*$)%\"yG\"\"&\"\"\"F(F&F(F(F(" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 237 "The \"restart\" command wipes out the va lues of all variables. But what do we do if we want to wipe out the va lue of x (i.e. undo just the assignment of x and not undo any other as signments). So we want x to be x again, not something else:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=x;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"xG%\"yG" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Thi s didn't work. Why? Well, when you do:" }}{PARA 0 "" 0 "" {TEXT -1 9 " x := x;" }}{PARA 0 "" 0 "" {TEXT -1 225 "then Maple will first evalu ate the right-hand side. But the right-hand side x had value y (we wil l say: x evaluates to y), so Maple replaces the right-hand side by y. \+ Because of that, the command: x:=x; doesn't do anything." }}{PARA 0 "" 0 "" {TEXT -1 43 "To unassign x, we have to do the following:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "x:='x';" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"xGF$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F ;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,(*$)%\"xG\"\"&\"\"\"F(F&F(F(F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%\"xG" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 514 "In Maple , the forward quotes are used when you don't want to evaluate an expre ssion. Lets say that x has the value 3, and you do x:=x; Then the righ t-hand side will be evaluated to 3, and the assignment you are doing w ill be just x:=3; Now what do you do if you want x to be x again, and not 3? The only way to do that is to make sure that the right-hand si de of x:=x; does not get evaluated, so that Maple will assign x to x, \+ instead of setting x to be the value of x which was 3. That is what th e quotes ' ' do:" }}{PARA 0 "" 0 "" {TEXT -1 2 " " }{TEXT 258 54 "the se quotes cause the expression to be not evaluated." }}{PARA 0 "" 0 " " {TEXT -1 63 "Let's look at some examples of what the quotes ' ' do i n Maple." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "d:=3;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"dG\"\"$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "d;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"$" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 421 "Typing d; will get you the same r esult as typing 3; because Maple evaluates d to 3, and then displays t he result. However, 'd' will get evaluated to d. In general, whenever \+ you type expression; then Maple will evaluate that expression as far as it can, so d; becomes 3. But when you type 'expression' then Maple will evaluate it to expression, and will do no further evaluation to \+ that. Let's see some examples of that:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "'''d'''; # Looks like: 'expression' where expressio n = ''d'' Hence:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#..%\"dG" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "%; # Now we're evaluating 'e xpression' where expression = 'd' so we get:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#.%\"dG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "%; # Each time we evaluate, we lose a pair of quotes, so we get:" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%\"dG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 81 "%; # When there are no more quotes left, then Maple w ill evaluate the expression:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"$ " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "%; # and of course 3 ev aluates to 3:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"$" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 353 "This shows the effect of the quotes. At \+ first we had something of the form 'expression' where expression was ' 'd'', so that will be the output. When you have Maple evaluate the out put ''d'', using the %; then the evaluation will remove another pair \+ of quotes. When there are no quotes, Maple will evaluate as far as it \+ can. Lets see an example of that:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "a:=b;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"aG%\"bG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "b:=c;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG%\"cG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "c:='d';" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"cG%\"dG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "a;" }}{PARA 11 "" 1 "" {XPPMATH 20 " 6#\"\"$" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 681 "Explanation: when you ask for a, Maple evaluates it as far as it can. And a evaluates to b, but then Maple thinks: hey, I can evaluate that further, and there ar e no quotes that tell me not to evaluate, so I evaluate further. It ev aluates the b into a c, and evaluates that into d (if I hadn't put quo tes around the d, then the value of c would not have been d, it would \+ have been 3, so in that case when it evaluates c the result wouldn't h ave been d, it would have been 3). But the d that Maple ends up with h as no quotes around it (those were removed in the evaluation during th e command c:='d';) so Maple will keep on evaluating, and then d evalua tes to 3. So a evaluates to 3." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "c:=''d'';" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"cG.%\"dG" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "a;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%\"dG" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "Now a, e valuates to b, which evaluates to c, which evaluates to 'd', and that \+ evaluates do d and Maple will stop there because the quotes tell Maple to stop." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "%;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"$" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 226 " At this point, the variables F, a, b, c, d have been assigned. And x h as been assigned, but then later unassigned. Suppose I want to clear t he value of all variables, I want to unassign all of them. I could do \+ this as follows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "a:='a'; " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"aGF$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "b:='b';" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG F$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "c:='c';" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%\"cGF$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "d:='d';" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"dGF$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "F:='F';" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"FGF$" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Or I c ould do it shorter by: a,b,c,d,F := 'a','b','c','d','F';" }}{PARA 0 " " 0 "" {TEXT -1 65 "A quicker way to unassign all variables is the fol lowing command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "Lets look at some operations \+ with polynomials." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "F:=(x^ 2+x+1)^5 * (x-1)^2*(x-2)*(x-2) * (x-3)^3;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"FG**),(*$)%\"xG\"\"#\"\"\"F,F*F,F,F,\"\"&F,),&F*F,F ,!\"\"F+F,),&F*F,F+F0F+F,),&F*F,\"\"$F0F5F," }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 392 "Maple acts lazy here, it pretty much just returns what I typed and does almost no computation. The only thing it did was to \+ replace (x-2)*(x-2) by (x-2)^2. You may expect it would multiply out a ll these products, but it didn't. To expand a product, you have to tel l Maple that that's what you want, otherwise it will think that the fo rm you gave is the polynomial is the form you want to see." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "F:=expand(F);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%\"FG,F\"$3\"!\"\"*&F&\"\"\"%\"xGF)F'*&\"$r\"F))F*\"\" #F)F'*&\"$U#F))F*\"\"%F)F)*&\"$5$F))F*\"\"$F)F)*&\"$)QF))F*\"\"'F)F'*& \"$\"[F))F*\"\"&F)F)*&\"$!\\F))F*\"\")F)F'*&\"$S\"F))F*\"\"(F)F'*&\"#C F))F*\"#5F)F'*&\"$7$F))F*\"\"*F)F)*&\"$g\"F))F*\"#7F)F'*&\"$A#F))F*\"# 6F)F)*&\"#SF))F*\"#8F)F)*&\"#VF))F*\"#9F)F'*&\"#MF))F*\"#:F)F)*&FJF))F *\"#;F)F'*$)F*\"# " 0 "" {MPLTEXT 1 0 10 "factor(F);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#**),(*$)%\"xG\"\"#\"\"\"F*F(F*F*F*\"\"&F*),&F(F*F* !\"\"F)F*),&F(F*F)F.F)F*),&F(F*\"\"$F.F3F*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 129 "So Maple can expand polynomials and factor polynomials. \+ Both go quickly. The factored form is often shorter, but not always, s ee:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "f:=x^100-1;" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fG,&*$)%\"xG\"$+\"\"\"\"F*F*!\"\" " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(f);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#*4,&%\"xG\"\"\"F&!\"\"F&,,F&F&*$)F%\"\"%F&F&*$) F%\"\"$F&F&*$)F%\"\"#F&F&F%F&F&,,F&F&*$)F%\"#?F&F&*$)F%\"#:F&F&*$)F%\" #5F&F&*$)F%\"\"&F&F&F&,&F&F&F%F&F&,,F&F&F%F'F/F&F,F'F)F&F&,,F&F&F " 0 "" {MPLTEXT 1 0 10 "expand(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&*$)% \"xG\"$+\"\"\"\"F(F(!\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "The polynomials f and F have a factor in common. The greatest common divi sor can be computed by the gcd." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "gcd(F,f);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&%\"xG\"\"\"F%!\" \"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 377 "Whenever a polynomial F ha s a root alpha of multiplicity e, with e>0, then the derivative F' has a root alpha with multiplicity e-1. Now F has roots with multipliciti es 5, 2 and 3, so the derivative F' will also have those roots, but wi th multiplicities 4, 1 and 2. It can also have other roots that F does not have (remember that the roots of F' are the critical points of F) ." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,F\"$3\"!\"\"*&F$\"\"\"%\"xGF'F%*&\"$r\"F')F(\"\"#F'F%* &\"$U#F')F(\"\"%F'F'*&\"$5$F')F(\"\"$F'F'*&\"$)QF')F(\"\"'F'F%*&\"$\"[ F')F(\"\"&F'F'*&\"$!\\F')F(\"\")F'F%*&\"$S\"F')F(\"\"(F'F%*&\"#CF')F( \"#5F'F%*&\"$7$F')F(\"\"*F'F'*&\"$g\"F')F(\"#7F'F%*&\"$A#F')F(\"#6F'F' *&\"#SF')F(\"#8F'F'*&\"#VF')F(\"#9F'F%*&\"#MF')F(\"#:F'F'*&FHF')F(\"#; F'F%*$)F(\"# " 0 "" {MPLTEXT 1 0 51 "diff(F ,x); # The derivative of F with respect to x" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,D\"$3\"!\"\"*&\"$U$\"\"\"%\"xGF(F%*&\"$o*F()F)\"\"$F(F (*&\"$I*F()F)\"\"#F(F(*&\"%GBF()F)\"\"&F(F%*&\"%0CF()F)\"\"%F(F(*&\"%? RF()F)\"\"(F(F%*&\"$!)*F()F)\"\"'F(F%*&\"$S#F()F)\"\"*F(F%*&\"%3GF()F) \"\")F(F(*&\"%?>F()F)\"#6F(F%*&\"%UCF()F)\"#5F(F(*&\"$?&F()F)\"#7F(F(* &\"$-'F()F)\"#8F(F%*&\"$5&F()F)\"#9F(F(*&\"$g\"F()F)\"#:F(F%*&\"# " 0 "" {MPLTEXT 1 0 12 "gcd(% , %%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,<*$)%\"xG\"#7\"\"\"F(*&\"\"&F()F&\" #6F(!\"\"*&\"\"$F()F&\"#5F(F(*&F/F()F&\"\"*F(F(*&\"#FF()F&\"\")F(F(*&F 4F()F&\"\"(F(F-*&F6F()F&\"\"'F(F-*&\"#vF()F&F*F(F-*&F6F()F&\"\"%F(F-*& F*F()F&F/F(F(*&\"#`F()F&\"\"#F(F(*&\"#LF(F&F(F(\"#=F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#**,&%\"xG\"\"\"F&!\"\"F&,&F%F&\"\"#F'F&),&F%F&\"\"$F'F) F&),(*$)F%F)F&F&F%F&F&F&\"\"%F&" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 261 "As you can see, when we took gcd(F, diff(F,x)) then the multiplic ity 5 of the factor x^2+x+1 became multiplicity 4, multiplicity 3 for \+ the factor x-3 became multiplicity 2, and the roots 1 and 2 (factors x -1 and x-2) with multiplicity 2 now have multiplicity 1." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 144 "With the gcd in f actored form, we can easily see that it is correct. We can differentia te twice, or 3 times, or more, and see what happens then:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "G1 := F;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%#G1G,F\"$3\"!\"\"*&F&\"\"\"%\"xGF)F'*&\"$r\"F))F*\"\" #F)F'*&\"$U#F))F*\"\"%F)F)*&\"$5$F))F*\"\"$F)F)*&\"$)QF))F*\"\"'F)F'*& \"$\"[F))F*\"\"&F)F)*&\"$!\\F))F*\"\")F)F'*&\"$S\"F))F*\"\"(F)F'*&\"#C F))F*\"#5F)F'*&\"$7$F))F*\"\"*F)F)*&\"$g\"F))F*\"#7F)F'*&\"$A#F))F*\"# 6F)F)*&\"#SF))F*\"#8F)F)*&\"#VF))F*\"#9F)F'*&\"#MF))F*\"#:F)F)*&FJF))F *\"#;F)F'*$)F*\"# " 0 "" {MPLTEXT 1 0 10 "f actor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#**),(*$)%\"xG\"\"#\"\"\"F *F(F*F*F*\"\"&F*),&F(F*F*!\"\"F)F*),&F(F*F)F.F)F*),&F(F*\"\"$F.F3F*" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "G2 := gcd( G1 , diff(G1,x) );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G2G,<*$)%\"xG\"#7\"\"\"F**& \"\"&F*)F(\"#6F*!\"\"*&\"\"$F*)F(\"#5F*F**&F1F*)F(\"\"*F*F**&\"#FF*)F( \"\")F*F**&F6F*)F(\"\"(F*F/*&F8F*)F(\"\"'F*F/*&\"#vF*)F(F,F*F/*&F8F*)F (\"\"%F*F/*&F,F*)F(F1F*F**&\"#`F*)F(\"\"#F*F**&\"#LF*F(F*F*\"#=F*" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#**,&%\"xG\"\"\"F&!\"\"F&,&F%F&\"\"#F'F&),&F%F&\"\"$F 'F)F&),(*$)F%F)F&F&F%F&F&F&\"\"%F&" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "G3 := gcd( G2, diff(G2,x) );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G3G,0*$)%\"xG\"\"(\"\"\"F**&\"\"$F*)F(\"\"&F*!\"\"*& \"#6F*)F(\"\"%F*F/*&\"#:F*)F(F,F*F/*&F5F*)F(\"\"#F*F/*&\"\")F*F(F*F/F, F/" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*&,&%\"xG\"\"\"\"\"$!\"\"F&),(*$)F%\"\"#F&F& F%F&F&F&F'F&" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "G4 := gcd(G 3, diff(G3,x) );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G4G,,*$)%\"xG\" \"%\"\"\"F**&\"\"#F*)F(\"\"$F*F**&F.F*)F(F,F*F**&F,F*F(F*F*F*F*" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*$),(*$)%\"xG\"\"#\"\"\"F*F(F*F*F*F)F*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "G5 := gcd(G4, diff(G4,x));" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G5G,(*$)%\"xG\"\"#\"\"\"F*F(F*F*F* " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,(*$)%\"xG\"\"#\"\"\"F(F&F(F(F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 95 "has(G5,x); # Checks if x still app ears in G5 (in other words, if the degree of G5 is still >0)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%%trueG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "G6 := gcd(G5, diff(G5,x) );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G6G\"\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "has(G6,x);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%&falseG" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 134 "We have seen that with differentiation a nd gcd's we can find factors of F that have different multiplicities. \+ That is what's called a " }{TEXT 259 26 "square-free factorization." } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,F\"$3\"!\"\"*&F$\"\"\"%\"xGF'F%*&\"$r\"F')F(\"\"#F'F%* &\"$U#F')F(\"\"%F'F'*&\"$5$F')F(\"\"$F'F'*&\"$)QF')F(\"\"'F'F%*&\"$\"[ F')F(\"\"&F'F'*&\"$!\\F')F(\"\")F'F%*&\"$S\"F')F(\"\"(F'F%*&\"#CF')F( \"#5F'F%*&\"$7$F')F(\"\"*F'F'*&\"$g\"F')F(\"#7F'F%*&\"$A#F')F(\"#6F'F' *&\"#SF')F(\"#8F'F'*&\"#VF')F(\"#9F'F%*&\"#MF')F(\"#:F'F'*&FHF')F(\"#; F'F%*$)F(\"# " 0 "" {MPLTEXT 1 0 11 "sqrfre e(F);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#7$\"\"\"7%7$,(*$)%\"xG\"\"#F$ F$*&\"\"$F$F*F$!\"\"F+F$F+7$,&F*F$F-F.F-7$,(F(F$F*F$F$F$\"\"&" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "G:=20*F;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%\"GG,F\"%g@!\"\"*&F&\"\"\"%\"xGF)F'*&\"%?MF))F*\"\"#F )F'*&\"%S[F))F*\"\"%F)F)*&\"%+iF))F*\"\"$F)F)*&\"%gxF))F*\"\"'F)F'*&\" %?'*F))F*\"\"&F)F)*&\"%+)*F))F*\"\")F)F'*&\"%+GF))F*\"\"(F)F'*&\"$![F) )F*\"#5F)F'*&\"%SiF))F*\"\"*F)F)*&\"%+KF))F*\"#7F)F'*&\"%SWF))F*\"#6F) F)*&\"$+)F))F*\"#8F)F)*&\"$g)F))F*\"#9F)F'*&\"$!oF))F*\"#:F)F)*&\"$+#F ))F*\"#;F)F'*&\"#?F))F*\"# " 0 "" {MPLTEXT 1 0 14 "v:=sqrfree(G);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"vG7$\"#? 7%7$,(*$)%\"xG\"\"#\"\"\"F.*&\"\"$F.F,F.!\"\"F-F.F-7$,&F,F.F0F1F07$,(F *F.F,F.F.F.\"\"&" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 162 "To recover a polynomial G from its square-free factorization, we can use the follo wing command (see the previous worksheet for an explanation of the com mand mul)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "v[1] * mul(i[ 1]^i[2], i=v[2]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$**\"#?\"\"\"),( *$)%\"xG\"\"#F&F&*&\"\"$F&F+F&!\"\"F,F&F,F&),&F+F&F.F/F.F&),(F)F&F+F&F &F&\"\"&F&F&" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 32 "Here v[1] = the c onstant factor." }}{PARA 0 "" 0 "" {TEXT -1 140 "And i runs through th e list [ [factor1, mult1], [factor2, mult2], .... ] so i[1] = a fact or, and i[2] = the multiplicity of that factor." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 60 "The square-free command s qrfree found the following factors:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "seq(i[1], i=v[2]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 %,(*$)%\"xG\"\"#\"\"\"F(*&\"\"$F(F&F(!\"\"F'F(,&F&F(F*F+,(F$F(F&F(F(F( " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 280 "It could compute those facto rs with diff and gcd because they all had different multiplicities. Ho wever, x-1 and x-2 had the same multiplicity, and because of that, x-1 and x-2 could not be seperated by just \"diff\" and \"gcd\". So sqrfr ee does not factor x^2-3*x+2 into (x-1)*(x-2)." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "G;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,F\"%g@! \"\"*&F$\"\"\"%\"xGF'F%*&\"%?MF')F(\"\"#F'F%*&\"%S[F')F(\"\"%F'F'*&\"% +iF')F(\"\"$F'F'*&\"%gxF')F(\"\"'F'F%*&\"%?'*F')F(\"\"&F'F'*&\"%+)*F') F(\"\")F'F%*&\"%+GF')F(\"\"(F'F%*&\"$![F')F(\"#5F'F%*&\"%SiF')F(\"\"*F 'F'*&\"%+KF')F(\"#7F'F%*&\"%SWF')F(\"#6F'F'*&\"$+)F')F(\"#8F'F'*&\"$g) F')F(\"#9F'F%*&\"$!oF')F(\"#:F'F'*&\"$+#F')F(\"#;F'F%*&\"#?F')F(\"# " 0 "" {MPLTEXT 1 0 10 "factor(G);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$*,\"#?\"\"\"),(*$)%\"xG\"\"#F&F&F+F&F&F&\" \"&F&),&F+F&F&!\"\"F,F&),&F+F&F,F0F,F&),&F+F&\"\"$F0F5F&F&" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "op(%); # op converts this product \+ into a sequence:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6'\"#?*$),(*$)%\"xG \"\"#\"\"\"F+F)F+F+F+\"\"&F+*$),&F)F+F+!\"\"F*F+*$),&F)F+F*F0F*F+*$),& F)F+\"\"$F0F7F+" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "%[3];" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#*$),&%\"xG\"\"\"F'!\"\"\"\"#F'" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "op(%); # op converts this a^ b into a sequence a,b" }}{PARA 11 "" 1 "" {XPPMATH 20 "6$,&%\"xG\"\"\" F%!\"\"\"\"#" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 192 "As you can see, \+ you can get the individual factors from the product with the op comman d. That's not always convenient, it's sometimes easier to use the comm and factors which does that for you." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "v:=factors(G);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>% \"vG7$\"#?7&7$,&%\"xG\"\"\"\"\"$!\"\"F,7$,(*$)F*\"\"#F+F+F*F+F+F+\"\"& 7$,&F*F+F+F-F27$,&F*F+F2F-F2" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "v[1];" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"#?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "v[2];" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#7&7 $,&%\"xG\"\"\"\"\"$!\"\"F(7$,(*$)F&\"\"#F'F'F&F'F'F'\"\"&7$,&F&F'F'F)F .7$,&F&F'F.F)F." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 167 "Now v is a li st with 2 elements. v[1] is the constant factor (which is not factored by the factors command), and v[2] is the list of factors with their m ultiplicities." }}{PARA 0 "" 0 "" {TEXT -1 13 "The commands " }{TEXT 260 6 "factor" }{TEXT -1 5 " and " }{TEXT 261 7 "factors" }{TEXT -1 200 " factor polynomials with coefficients that are rational numbers. \+ Since 20 is a unit in the rational numbers, it will not be factored by those commands. To factor integers there is a different command:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "ifactor(20);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*&)-%!G6#\"\"#F(\"\"\"-F&6#\"\"&F)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "igcd(20,50);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"#5" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "igcd (10^100-1, 1000!);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\",R6#e)y#" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ifactor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*.)-%!G6#\"\"$\"\"#\"\"\"-F&6#\"#6F*-F&6#\"#TF*-F& 6#\"$,\"F*-F&6#\"$^#F*-F&6#\"$r#F*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 3 0" 44 }{VIEWOPTS 1 1 0 3 2 1804 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }