{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 }{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 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Operations with polynomial s and the use of quotes ' ' in Maple." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "F:=x^5+x+1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "x:=12;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=1;" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "F;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=y;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "x:='x';" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 2 "F;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 604 "In Maple, the forward quotes a re used when you don't want to evaluate an expression. Lets say that x has the value 3, and you do x:=x; Then the right-hand side will be ev aluated to 3, and the assignment you are doing will be just x:=3; Now what do you do if you want x to be x again, and not 3? The only way t o do that is to make sure that the right-hand side of x:=x; does not g et evaluated, so that Maple will set x to be x, instead of setting x t o be the value of x which was 3. That is what the quotes ' ' do, they \+ stop the evaluation. Let's look at some examples of what the quotes ' \+ ' do in Maple." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "d:=3;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "d;" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 409 "Typing d; will be the same as typing 3; because Maple \+ evaluates d to 3, and then displays the 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 8 "'''d''';" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "%;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "%;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "%; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "%;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "%;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 353 "Th is shows the effect of the quotes. At first we had something of the fo rm 'expression' where expression was ''d'', so that will be the output . When you have Maple evaluate the output ''d'', using the %; then th e evaluation will remove another pair of quotes. When there are no quo tes, Maple will evaluate as far as it can. Lets see an example of that :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "a:=b;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "b:=c;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "c:='d';" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "a ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 681 "Explanation: when you ask f or a, Maple evaluates it as far as it can. And a evaluates to b, but t hen Maple thinks: hey, I can evaluate that further, and there are no q uotes that tell me not to evaluate, so I evaluate further. It evaluate s the b into a c, and evaluates that into d (if I hadn't put quotes ar ound the d, then the value of c would not have been d, it would have b een 3, so in that case when it evaluates c the result wouldn't have be en d, it would have been 3). But the d that Maple ends up with has no \+ quotes around it (those were removed in the evaluation during the comm and c:='d';) so Maple will keep on evaluating, and then d evaluates to 3. So a evaluates to 3." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 " c:=''d'';" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "a;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "Now a, evaluates to b, which evaluates t o c, which evaluates to 'd', and that evaluates do d and Maple will st op there because the quotes tell Maple to stop." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "%;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 226 "At \+ this point, the variables F, a, b, c, d have been assigned. And x has \+ been assigned, but then later unassigned. Suppose I want to clear the \+ value of all variables, I want to unassign all of them. I could do thi s as follows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "a:='a';" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "b:='b';" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 7 "c:='c';" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "d:='d';" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "F :='F';" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Or I could do it shorte r 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 following command: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "Lets look at some operations with polynom ials." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "F:=(x^2+x+1)^5 * ( x-1)^2*(x-2)^2 * (x-3)^3;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 320 "Map le acts lazy here. You may expect it would multiply out all these prod ucts, but it just returns what I've typed without doing any computatio n. To expand a product, you have to tell Maple that that's what you wa nt, otherwise it will think that the form in which it first saw the po lynomial is the form you want to see." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "F:=expand(F);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 196 "In this particular example there was good reason not to expand, b ecause the expanded form is longer than the factored form. What if you only have the expanded form, and you want the factored form?" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(F);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 149 "So Maple can expand polynomials (which is easy ) and factor polynomials (that's not trivial). The factored form is of ten shorter, but not always, see:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "f:=x^100-1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(f);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "expand( %);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "The polynomials f and F h ave 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);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 310 "Whenever a polynomial F has a roo t alpha of multiplicity e, with e>0, then the derivative has a root al pha with multiplicity e-1. Now F has roots with multiplicities 5, 2 an d 3, so the derivative will also have those roots, but with multiplici ties 4, 1 and 2. It can also have other roots that F does not have." } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "diff(F,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "gcd(% , %%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 144 "With the gcd in factored form, we can easily see that it is correct. We can differ entiate twice, or 3 times, or more, and see what happens then:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "gcd( F , diff(F,x,x) );" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "factor( gcd(F, diff(F,x,x,x)) );" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "factor( gcd(F, diff(F,x,x,x, x)) );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "factor( gcd(F, di ff(F,x$5)) );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "x$5;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "seq(x, i=1..5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 111 "The $n in Maple means: repeat that expre ssion n times, you get a sequence with n entries that are all the same ." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 160 "We \+ have seen that with differentiation and gcd's we can find factors of F that have different multiplicities. That is what's called a square-fr ee factorization." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "F;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "sqrfree(F);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "G:=20*F;" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 14 "v:=sqrfree(G);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "v[1] * mul(i[1]^i[2], i=v[2]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "So the square-free command sqrfree found the followi ng factors:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "seq(i[1], i= v[2]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 203 "It could compute those factors with diff and gcd because they all had different multipliciti es. However, x-1 and x-2 had the same multiplicity, and then sqrfree c an not factor x^2-3*x+2 into (x-1)*(x-2)." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 2 "G;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "fac tor(G);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "op(%);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "%[3];" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 6 "op(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 180 "As you can see, you can get the individual factors from the product w ith the op command. That's not always convenient, it's sometimes easie r to use factors which does that for you." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 14 "v:=factors(G);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "v[1];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "v[2 ];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 167 "Now v is a list with 2 ele ments. v[1] is the constant factor (which is not factored by the facto rs command), and v[2] is the list of factors with their multiplicities ." }}{PARA 0 "" 0 "" {TEXT -1 230 "The command factor and factors fact or polynomials with coefficients that are rational numbers. Since 20 i s a unit in the rational numbers, it will not be factored by those com mands. To factor integers there is a different command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "ifactor(20);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 12 "igcd(20,50);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "igcd(10^100-1, 1000!);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ifactor(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "88" 0 }{VIEWOPTS 1 1 0 1 1 1803 }