{VERSION 3 0 "SGI MIPS UNIX" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 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 "" 1 24 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 1 24 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 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 0 1 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 -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 }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 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 43 "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+" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 193 "When we assigned F, the variable \+ x had not 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 h ave 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 assi gn x and then F, but first F and then x. That makes a difference, beca use even though F now looks like 3, it really is still x^5+x+1 which j ust happens to evaluate to 3 but is not quite the same thing as 3. Thi s becomes visible if you change x. Changing x will have no impact on 3 , but 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)" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 237 "The \"restart\" comman d wipes out the values of all variables. But what do we do if we want \+ to wipe out the value of x (i.e. undo just the assignment of x and not undo any other assignments). So we want x to be x again, not somethin g 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 "This 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 evaluate the right-hand side. But the right-hand side x ha d value y (we will say: x evaluates to y), so Maple replaces the right -hand side by y. Because of that, the command: x:=x; doesn't do anyt hing." }}{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)" }}}{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 wan t to evaluate an expression. Lets say that x has the value 3, and you \+ do x:=x; Then the right-hand side will be evaluated to 3, and the assi gnment you are doing will be just x:=3; Now what do you do if you wan t x to be x again, and not 3? The only way to do that is to make sure \+ that the right-hand side of x:=x; does not get evaluated, so that Mapl e will assign x to x, instead of setting x to be the value of x which \+ was 3. That is what the quotes ' ' do:" }}{PARA 0 "" 0 "" {TEXT -1 2 " " }{TEXT 258 54 "these quotes cause the expression to be not evaluat ed." }}{PARA 0 "" 0 "" {TEXT -1 63 "Let's look at some examples of wha t the quotes ' ' do in 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 yo u the same result as typing 3; because Maple evaluates d to 3, and the n displays the result. However, 'd' will get evaluated to d. In genera l, whenever you type expression; then Maple will evaluate that expre ssion 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 ev aluation to that. Let's see some examples of that:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "'''d'''; # Looks like: 'expression' where expression = ''d'' Hence:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#..%\"dG " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "%; # Now we're evaluati ng 'expression' 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+F,),&F*F-!\"$F-\"\"$F," }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 392 "Maple acts lazy here, it pretty much just retu rns 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 multip ly out all these products, but it didn't. To expand a product, you hav e to tell Maple that that's what you want, otherwise it will think tha t the form 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\"\"\"\"*$)%\"xG\"\"#\"\"\"!$r\"*$)F* \"\"%F,\"$U#*$)F*\"\"$F,\"$5$*$)F*\"\"'F,!$)Q*$)F*\"\"&F,\"$\"[*$)F*\" \")F,!$!\\*$)F*\"\"(F,!$S\"*$)F*\"#5F,!#C*$)F*\"\"*F,\"$7$F*F&*$)F*\"# 7F,!$g\"*$)F*\"#6F,\"$A#*$)F*\"#9F,!#V*$)F*\"#8F,\"#S*$)F*\"#:F,\"#M*$ )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*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 129 "So Maple can expand polynomials and fact or polynomials. Both go quickly. The factored form is often shorter, b ut not always, see:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "f:=x ^100-1;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fG,&*$)%\"xG\"$+\"\"\" \"\"\"\"!\"\"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%\"#5F,F&*$)F%\"\"&F,F&F&F&F&,&F%F&F&F&F&,,F&F&F%F'F0F&F- F'F)F&F&,,F&F&F=F'F:F&F7F'F4F&F&,&F&F&F0F&F&,,*$)F%\"\")F,F&*$)F%\"\"' F,F'F)F&F0F'F&F&F&,,*$)F%\"#SF,F&*$)F%\"#IF,F'F4F&F:F'F&F&F&" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "expand(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&*$)%\"xG\"$+\"\"\"\"\"\"\"!\"\"F)" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "The polynomials f and F have a factor in common. The greatest common divisor 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 has a root alpha of multiplicity e, with e>0, then the derivative F' has a root alpha with multiplicit y e-1. Now F has roots with multiplicities 5, 2 and 3, so the derivati ve F' will also have those roots, but with multiplicities 4, 1 and 2. \+ It can also have other roots that F does not have (remember that the r oots 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\"\"\"\"* $)%\"xG\"\"#\"\"\"!$r\"*$)F(\"\"%F*\"$U#*$)F(\"\"$F*\"$5$*$)F(\"\"'F*! $)Q*$)F(\"\"&F*\"$\"[*$)F(\"\")F*!$!\\*$)F(\"\"(F*!$S\"*$)F(\"#5F*!#C* $)F(\"\"*F*\"$7$F(F$*$)F(\"#7F*!$g\"*$)F(\"#6F*\"$A#*$)F(\"#9F*!#V*$)F (\"#8F*\"#S*$)F(\"#:F*\"#M*$)F(\"# " 0 "" {MPLTEXT 1 0 10 "diff(F,x);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,D%\"xG!$U$*$)F$\"\"$\"\"\"\"$o**$)F$\"\"#F)\"$I**$)F$ \"\"&F)!%GB*$)F$\"\"%F)\"%0C*$)F$\"\"(F)!%?R*$)F$\"\"'F)!$!)**$)F$\"\" *F)!$S#*$)F$\"\")F)\"%3G!$3\"\"\"\"*$)F$\"#6F)!%?>*$)F$\"#5F)\"%UC*$)F $\"#8F)!$-'*$)F$\"#7F)\"$?&*$)F$\"#9F)\"$5&*$)F$\"#;F)\"#<*$)F$\"#:F)! $g\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "gcd(% , %%);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#,<*$)%\"xG\"#7\"\"\"\"\"\"*$)F&\"#6F(! \"&*$)F&\"#5F(\"\"$*$)F&\"\"*F(F1*$)F&\"\")F(\"#F*$)F&\"\"(F(!\"**$)F& \"\"'F(!#F*$)F&\"\"&F(!#v*$)F&\"\"%F(F@*$)F&F1F(FC*$)F&\"\"#F(\"#`F&\" #L\"#=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." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 261 "As you can see, when we took gcd(F, diff (F,x)) then the multiplicity 5 of the factor x^2+x+1 became multiplici ty 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 mult iplicity 1." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 144 "With the gcd in factored form, we can easily see that it is co rrect. We can differentiate twice, or 3 times, or more, and see what h appens then:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "G1 := F;" }} {PARA 12 "" 1 "" {XPPMATH 20 "6#>%#G1G,F!$3\"\"\"\"*$)%\"xG\"\"#\"\"\" !$r\"*$)F*\"\"%F,\"$U#*$)F*\"\"$F,\"$5$*$)F*\"\"'F,!$)Q*$)F*\"\"&F,\"$ \"[*$)F*\"\")F,!$!\\*$)F*\"\"(F,!$S\"*$)F*\"#5F,!#C*$)F*\"\"*F,\"$7$F* F&*$)F*\"#7F,!$g\"*$)F*\"#6F,\"$A#*$)F*\"#9F,!#V*$)F*\"#8F,\"#S*$)F*\" #:F,\"#M*$)F*\"# " 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*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "G2 := gcd( G1 , diff(G1,x) );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G 2G,<*$)%\"xG\"#7\"\"\"\"\"\"*$)F(\"#6F*!\"&*$)F(\"#5F*\"\"$*$)F(\"\"*F *F3*$)F(\"\")F*\"#F*$)F(\"\"(F*!\"**$)F(\"\"'F*!#F*$)F(\"\"&F*!#v*$)F( \"\"%F*FB*$)F(F3F*FE*$)F(\"\"#F*\"#`F(\"#L\"#=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." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "G 3 := gcd( G2, diff(G2,x) );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G3G, 0*$)%\"xG\"\"(\"\"\"\"\"\"*$)F(\"\"&F*!\"$*$)F(\"\"%F*!#6*$)F(\"\"$F*! #:*$)F(\"\"#F*F7F(!\")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-" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "G4 := gcd(G3, diff(G3,x) );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#G4G,,*$)%\"xG\"\"%\"\"\"\"\"\"*$)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*" }}}{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+" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "fac tor(%);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,(*$)%\"xG\"\"#\"\"\"\"\"\" F&F)F)F)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "has(G5,x); # S ame as checking if degree(G5,x) is >0 or not." }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%%trueG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "G 6 := 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 and gcd's we can \+ find factors of F that have different multiplicities. That is what's c alled a " }{TEXT 259 26 "square-free factorization." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,F!$ 3\"\"\"\"*$)%\"xG\"\"#\"\"\"!$r\"*$)F(\"\"%F*\"$U#*$)F(\"\"$F*\"$5$*$) F(\"\"'F*!$)Q*$)F(\"\"&F*\"$\"[*$)F(\"\")F*!$!\\*$)F(\"\"(F*!$S\"*$)F( \"#5F*!#C*$)F(\"\"*F*\"$7$F(F$*$)F(\"#7F*!$g\"*$)F(\"#6F*\"$A#*$)F(\"# 9F*!#V*$)F(\"#8F*\"#S*$)F(\"#:F*\"#M*$)F(\"# " 0 "" {MPLTEXT 1 0 11 "sqrfree(F);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#7$\"\"\"7%7$,(*$)%\"xG\"\"#\"\"\"F$F*!\"$F+F$F+7$, &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@\"\"\"*$)%\"xG\"\"#\"\"\"!%?M*$)F*\"\"%F,\"%S[*$)F*\"\"$F,\"%+i*$)F* \"\"'F,!%gx*$)F*\"\"&F,\"%?'**$)F*\"\")F,!%+)**$)F*\"\"(F,!%+G*$)F*\"# 5F,!$![*$)F*\"\"*F,\"%SiF*F&*$)F*\"#7F,!%+K*$)F*\"#6F,\"%SW*$)F*\"#9F, !$g)*$)F*\"#8F,\"$+)*$)F*\"#:F,\"$!o*$)F*\"# " 0 "" {MPLTEXT 1 0 14 "v:=sqrfree(G);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"vG7$\"#?7%7$,(*$)%\"xG\"\"#\"\"\"\"\"\"F,! \"$F-F/F-7$,&F,F/F0F/\"\"$7$,(F*F/F,F/F/F/\"\"&" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 162 "To recover a polynomial G from its square-free fact orization, we can use the following command (see the previous workshee t for an explanation of the command 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+\"#?" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 32 "Here v[1] = the constant factor." }}{PARA 0 "" 0 "" {TEXT -1 140 "And i runs through the list [ [factor1, mult1], [factor2, mult2] , .... ] so i[1] = a factor, and i[2] = the multiplicity of that fa ctor." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 60 " The square-free command sqrfree 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)" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 280 "It could co mpute those factors with diff and gcd because they all had different m ultiplicities. However, x-1 and x-2 had the same multiplicity, and bec ause of that, x-1 and x-2 could not be seperated by just \"diff\" and \+ \"gcd\". So sqrfree 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@\"\"\"*$)%\"xG\"\"#\"\"\"!%?M*$)F(\"\"%F*\"%S[*$) F(\"\"$F*\"%+i*$)F(\"\"'F*!%gx*$)F(\"\"&F*\"%?'**$)F(\"\")F*!%+)**$)F( \"\"(F*!%+G*$)F(\"#5F*!$![*$)F(\"\"*F*\"%SiF(F$*$)F(\"#7F*!%+K*$)F(\"# 6F*\"%SW*$)F(\"#9F*!$g)*$)F(\"#8F*\"$+)*$)F(\"#:F*\"$!o*$)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'F(F(F(\"\"&F+ \"#?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "op(%); # op conver ts 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(F'F(F(F(\"\"&F+" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "%[3];" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*$),&%\"xG\" \"\"!\"#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 command. That's not always convenient, it's so metimes easier to use the command 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+\"\"&7$,&F*F+!\"#F+F27$,&F*F+!\"\"F+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'\"\"&7$,&F&F'!\"#F'F.7$,&F&F'!\"\"F'F." }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 167 "Now v is a list with 2 elements. \+ v[1] is the constant factor (which is not factored by the factors comm and), and v[2] is the list of factors with their multiplicities." }} {PARA 0 "" 0 "" {TEXT -1 13 "The commands " }{TEXT 260 6 "factor" } {TEXT -1 5 " and " }{TEXT 261 7 "factors" }{TEXT -1 200 " factor polyn omials with coefficients that are rational numbers. Since 20 is a unit in the rational numbers, it will not be factored by those commands. T o 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#\"\"&\"\"\"" }}}{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#\"#6\"\"\"-F&6#\"#TF.-F&6#\"$,\"F.-F&6# \"$^#F.-F&6#\"$r#F." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} }{MARK "98 1" 0 }{VIEWOPTS 1 1 0 1 1 1803 }