{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 "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 "Error" 7 8 1 {CSTYLE "" -1 -1 "" 0 1 255 0 255 1 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 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 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "# A shor t introduction to Maple." }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "# Note, frst, how we write comments - after # " } {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "# \+ Commands" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "# Every command should be fi nished by ; or :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "# The d ifferense is that in the last case the result is not prinitng" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "# For example, to finish the session you can write quite;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "# Most commands have natural notations. E.g." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "2+2;2^5; 4!;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"%" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"#K" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#\"#C" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "# \+ the last one was factorial: 4!=1*2*3*4;" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "# \+ Numbers, polynomials and gcd." }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "# You \+ can easy find the greatest common divisor, e.g (60,48), using igcd:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "igcd(60,48);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#\"#7" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "#i stands for integers. Clear gcd is used for polynomials:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "gcd (x^2-1,x^3-1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&%\"xG\"\"\"F%!\"\"" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 57 "#Your can find a greatest commomd diviser of m any numbers" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "igcd(24,30,4 8,6000);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"'" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 20 "#but not polynomials" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 22 "gcd( x^3-1,2*x^2-2,x);" }}{PARA 8 "" 1 "" {TEXT -1 248 "Error, (in gcd) The optional 3rd argument given to `gcd` was x. This argument to `gcd` is for returning the cofactor. It is no t for specifying the variable in which to compute the GCD. If assigned , it could create a recursive definition of a name.\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "#Your even able to get a decomposit ion d=a*u+b*v,if d=(a,b). For this" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "#You need an extended version igcdex. Look, how it wo rks:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "igcdex(60,108,'u',' v');" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"#7" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "u;v;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"#" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#!\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "#It is correct: 12 = 2*60 -(-1)*108);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 71 "#note important thing: x and y were quoted 'u', 'v'. To understand why," }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "#let us try another example without quotes:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "igcdex(4,5,u,v);" }}{PARA 8 "" 1 "" {TEXT -1 53 "Error, (in igcdex) illegal use of a formal parame ter\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "#nevertheless the \+ following works:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "igcdex( 4,5,c,d);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "c;d;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#! \"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"\"" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 120 "#The differnence is that c and d had no value s before, so there were #names (variables). It is not the case for a a nd b." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "# After applying i gcdex(60,108,'u','v'); u and v get a value" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 68 "#2 and 1. So they became numbers, not variables and igcdex(4,5,u,v);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 144 "#was \+ in reality igcdex(4,5,2,-1); and it did not work. To save the #situati on we need to recover names and exactly this is perfomed by #quoting. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "#Quoting is very import ant operation in Maple and it is recommended to" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 117 "#quot varibles before using to be sure that t hey are not values. For #example we can recover names back as followin g:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "u:='u'; v:='v';" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"uGF$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"vGF$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "#Now igcd ex(4,5,u,v); works;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "igcd ex(4,5,u,v); u;v;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\" \"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "#The extended versi on of gcd works for polynomials too:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "gcdex(x^2-2,x^3+3,'x','u','v');u;v;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,(\"\"%\" \"\"*&\"\"#F%)%\"xGF'F%F%*&\"\"$F%F)F%!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&\"\"$\"\"\"*&\"\"#F%%\"xGF%!\"\"" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 49 "#because (4-2*x^2-3*x)*(x^2-2)+(3-2*x)*(x^3+ 3)=1." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 235 "#Note a differenc e - on the third place we put a letter x. It is #necessary to show Map le, that exactly x is the unknown variable for our #polynomials.Note a lso, that a and b became now polynomials. Let us talk #about them litt le more:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1 "#" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "# Polynomials" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1 "#" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 131 "#It is important to note that Maple saves polynomi als not in the same #form as we do. Let us see for our polynomial \"u \" once again:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "u;" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#,(\"\"%\"\"\"*&\"\"#F%)%\"xGF'F%F%*&\" \"$F%F)F%!\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "# We woul d like to write this in some other order. This can be done " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "# using command sort: (the s econd parameter shows the name of variable.)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sort(u,x);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,( *&\"\"#\"\"\")%\"xGF%F&F&*&\"\"$F&F(F&!\"\"\"\"%F&" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "#The result of" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 8 "(x+1)^5;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*$),&%\" xG\"\"\"F'F'\"\"&F'" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "#is \+ correct, but, probably, not we wanted. To expand it we, " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "# use, as you can guess, the comman d expand" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "expand((x+1)^5) ;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,.*$)%\"xG\"\"&\"\"\"F(*&F'F()F& \"\"%F(F(*&\"#5F()F&\"\"$F(F(*&F-F()F&\"\"#F(F(*&F'F(F&F(F(F(F(" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "#Sometimes we need to combin e both commands:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "expand( (x+1)^25);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,V\"\"\"F$*&\"#DF$%\"xGF $F$*&\"&]E\"F$)F'\"\"%F$F$*&\"(g(oKF$)F'\"#5F$F$*&\"(+.?&F$)F'\"#7F$F$ *&\"(+uX%F$)F'\"#6F$F$*&\"$+$F$)F'\"\"#F$F$*&\"%+BF$)F'\"\"$F$F$*&\"'+ rF$F$*&FQF$)F'\"#?F$F$*&F)F$)F'\"#@F$F$*&F=F$)F'\"#AF$F$*&F 9F$)F'\"#BF$F$*&F&F$)F'\"#CF$F$*$)F'F&F$F$" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 17 "#looks bad sorted" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "sort(expand((x+1)^25),x);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,V*$)%\"xG\"#D\"\"\"F(*&F'F()F&\"#CF(F(*&\"$+$F()F&\"#B F(F(*&\"%+BF()F&\"#AF(F(*&\"&]E\"F()F&\"#@F(F(*&\"&IJ&F()F&\"#?F(F(*& \"'+rF(F(*&\"'+2[F()F&\"#=F(F(*&\"(v:3\"F()F&\"# " 0 "" {MPLTEXT 1 0 21 "#is much mo re better." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "# Factorisation " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 56 "# Maple can factorise number and check if they are prime" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "# (if the num ber is not too large, till ex has less then 7 digits)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "# commands are ifactor and isprime: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "ifactor (240);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#*()-%!G6#\"\"#\"\"%\"\"\"-F&6#\"\"$F*- F&6#\"\"&F*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "isprime(1001 );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%&falseG" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 14 "ifactor(1001);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*(-%!G6#\"\"(\"\"\"-F%6#\"#6F(-F%6#\"#8F(" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 14 "isprime(1003);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%&falseG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "ifactor(1 003);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*&-%!G6#\"#<\"\"\"-F%6#\"#fF( " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "isprime(1013);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%%trueG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "ifactor(1013);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%! G6#\"%85" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "# it is also po ssible to factorise polynomials;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "factor(x^3-1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*&, &%\"xG\"\"\"F&!\"\"F&,(*$)F%\"\"#F&F&F%F&F&F&F&" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 14 "factor(x^4+4);" }}{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 55 "#but note, that t his is a factorisation over rationals." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "#For example the following" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "factor(x^4+1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# ,&*$)%\"xG\"\"%\"\"\"F(F(F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "#shows that the following factorization was not found!" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "f:=(x^2-sqrt(2)*x+1)*(x^2+sqrt(2)*x +1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fG*&,(*$)%\"xG\"\"#\"\"\"F +*&F*#F+F*F)F+!\"\"F+F+F+,(F'F+F,F+F+F+F+" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 11 "expand (f);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&*$ )%\"xG\"\"%\"\"\"F(F(F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 " #note also that we used f as a short name for our (not-expanded) polyn om." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "#note also that assi gment was done by :=. Usual = is used for equations:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "f=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 "" {MPLTEXT 1 0 74 "# But using more complicate d command Factor (with capital F) we can do it:" }{TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 1 " " }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "alias(alpha=RootOf(x^2-2)):\nevala(Factor(x^4+1,alpha ));" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #*&,(*$)%\"xG\"\"#\"\"\"F)*&F'F)%&alphaGF)F)F)F)F),(F%F)F*!\"\"F)F)F) " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "# Modul ar arithmetic" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "# One of a dvantages of Maple is a possibility to works in Z_n:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "# Suppose we want to work mod 5. It is ea sy:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "2+4 mod 5;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "2^3 mod 5;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"$" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "-1 mod 5;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"%" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Factor (x^3+2) mod 5;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#*&,&%\"xG\"\"\"\"\"$F&F&,(*$)F%\"\"#F& F&*&F+F&F%F&F&\"\"%F&F&" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 " #Note, nevetheless the capital F here." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "94 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }