#1: " ----------[ D e r i v e ]---------- " User #2: " ---------- Initialization ---------- " User #3: " ---------- Algebra ---------- " User User #4: " One would think that the simplification 2 2^n => 2^(n + 1) would happen " #5: " automatically or at least easily ... " User n #6: 2*2 User n + 1 #7: 2 Simp(#6) User #8: " And how about 4 2^n => 2^(n + 2)? [Richard Fateman] " n #9: 4*2 User n + 2 #10: 2 Simp(#9) #11: " (-1)^[n (n + 1)] => 1 for integer n " User #12: n :epsilon Integer User #13: n Simp(#12) n*(n + 1) #14: (-1) User n*(n + 1) #15: (-1) Simp(#14) #16: n := User #17: " Also easy => 2 (3 x - 5) " User #18: FACTOR(6*x - 10) User #19: 2*(3*x - 5) Simp(#18) User #20: " Univariate gcd: gcd(p1, p2) => 1, gcd(p1 q, p2 q) => q [Richard Liska] " 34 47 8 5 60 #21: p1 := 64*x - 21*x - 126*x - 46*x - 16*x - 81 User User 60 25 23 39 52 10 #22: p2 := 72*x - 25*x - 19*x - 22*x - 83*x + 54*x + 81 19 16 7 3 #23: q := 34*x - 25*x + 70*x + 20*x - 91*x - 86 User #24: POLY_GCD(p1, p2) User #25: 1 Simp(#24) #26: POLY_GCD(EXPAND(p1*q), EXPAND(p2*q)) - q User #27: 0 Simp(#26) #28: " resultant(p1 q, p2 q) => 0 " User #29: "resultant(EXPAND(p1*q), EXPAND(p2*q), x)" User #30: " How about factorization? => p1 * p2 " User #31: FACTOR(EXPAND(p1*p2)) User Simp(#31) 120 112 107 99 94 #32: - 1152*x + 1328*x - 1512*x + 2095*x + 4608*x - 86 85 83 73 72 70 4850*x + 400*x + 304*x - 1408*x + 525*x - 465*x - 68 65 60 59 57 9072*x - 3312*x + 3330*x - 1600*x + 1468*x + 52 47 44 39 34 6723*x + 1071*x + 4468*x + 1782*x + 5184*x + 33 31 30 28 25 23 3150*x + 2394*x + 1150*x + 874*x + 2025*x + 1539*x 18 15 10 8 5 - 6804*x - 2484*x - 4374*x - 10206*x - 3726*x - 6561 #33: p1 := User #34: p2 := User #35: q := User User #36: " Multivariate gcd: gcd(p1, p2) => 1, gcd(p1 q, p2 q) => q " User 19 8 17 5 8 15 9 2 22 #37: p1 := 24*x*y *z - 47*x *y *z + 6*x *y *z - 3*x + 5 User 5 8 13 7 7 7 9 16 4 14 #38: p2 := 34*x *y *z + 20*x *y *z + 12*x *y *z + 80*y *z 12 7 13 2 8 10 17 5 8 #39: q := 11*x *y *z - 23*x *y *z + 47*x *y *z User #40: POLY_GCD(p1, p2) User Aborted after 1 hour #41: POLY_GCD(EXPAND(p1*q), EXPAND(p2*q)) - q User Aborted after 1 hour #42: " How about factorization? => p1 * p2 " User #43: FACTOR(EXPAND(p1*p2)) User Simp(#43) 7 31 9 3 29 6 27 12 #44: - 2*y *z*(18*x *y *z + 30*x *z + 51*x *y*z + 26 14 11 24 5 5 9 13 282*x *y *z + 2*x *y *z *(235*z - 18*y ) - 22 6 3 8 20 20 10 14 x *y *(60*y *z - 120*y - 799*z ) - 102*x *y *z + 17 12 8 15 16 2 10 28 11 1880*x *y *z - 240*x *y *z - 144*x *y *z - 9 9 3 8 19 14 7 6 6 20 20 30*x *y *z - 240*x *y *z - 50*x *z - 408*x *y *z - 5 12 26 8 7 85*x *y*z - 960*x*y *z - 200*y ) #45: p1 := User #46: p2 := User #47: q := User #48: " => x^n for n > 0 [Chris Hurlburt] " User n + 4 n + 2 n + 1 n #49: POLY_GCD(2*x - x , 4*x + 3*x ) User n #50: x Simp(#49) User #51: " Resultants. If the resultant of two polynomials is zero, this implies they " User #52: " have a common factor. See Keith O. Geddes, Stephen R. Czapor and George " User #53: " Labahn, _Algorithms for Computer Algebra_, Kluwer Academic Publishers, 1992, " #54: " p. 286 => 0 " User User #55: "resultant(3*x^4 + 3*x^3 + x^2 - x - 2, x^3 - 3*x^2 + x + 5, x)" User #56: " Numbers are nice, but symbols allow for variability---try some high school " #57: " algebra: rational simplification => (x - 2)/(x + 2) "User 2 x - 4 #58: -------------- User 2 x + 4*x + 4 x - 2 #59: ------- Simp(#58) x + 2 User #60: " This example requires more sophistication => e^(x/2) - 1 " / x \ | #e - 1 EXP(x) - 1 | |-----------, --------------| #61: | x/2 / x \ | User | #e + 1 EXP|---| + 1 | \ \ 2 / / / x/2 x/2 \ #62: \#e - 1, #e - 1/ Simp(#61) #63: " Expand and factor polynomials " User 20 #64: q1_ := (x + 1) User #65: q2_ := EXPAND(q1_) User #66: q2_ User Simp(#66) 20 19 18 17 16 15 #67: x + 20*x + 190*x + 1140*x + 4845*x + 15504*x + 14 13 12 11 10 38760*x + 77520*x + 125970*x + 167960*x + 184756*x + 9 8 7 6 5 167960*x + 125970*x + 77520*x + 38760*x + 15504*x + 4 3 2 4845*x + 1140*x + 190*x + 20*x + 1 d #68: q3_ := -- q2_ User dx #69: q3_ User Simp(#69) 19 18 17 16 15 14 #70: 20*x + 380*x + 3420*x + 19380*x + 77520*x + 232560*x 13 12 11 10 + 542640*x + 1007760*x + 1511640*x + 1847560*x + 9 8 7 6 5 1847560*x + 1511640*x + 1007760*x + 542640*x + 232560*x + 4 3 2 77520*x + 19380*x + 3420*x + 380*x + 20 #71: FACTOR(q3_) User 19 #72: 20*(x + 1) Simp(#71) User #73: " Completely factor this polynomial, then try to multiply it back together! " 3 2 #74: q1_ := FACTOR(x + x - 7, Complex) User #75: q1_ User Simp(#75) / / 187 SQRT(3885) \1/3 / SQRT(3885) 187 \1/3 #76: |x - |----- - ------------| - |------------ + -----| + \ \ 54 18 / \ 18 54 / 1 \ / / 187 SQRT(3885) \1/3 / SQRT(3885) ---|*|x + |----- - ------------| + |------------ + 3 / \ \ 432 144 / \ 144 187 \1/3 1 // 187*SQRT(3) SQRT(1295) \1/3 -----| + --- + #i*||------------- - ------------| - 432 / 3 \\ 144 16 / / 187*SQRT(3) SQRT(1295) \1/3\\ / / 187 |------------- + ------------| ||*|x + |----- - \ 144 16 / // \ \ 432 SQRT(3885) \1/3 / SQRT(3885) 187 \1/3 1 ------------| + |------------ + -----| + --- + 144 / \ 144 432 / 3 // 187*SQRT(3) SQRT(1295) \1/3 / 187*SQRT(3) #i*||------------- + ------------| - |------------- - \\ 144 16 / \ 144 SQRT(1295) \1/3\\ ------------| || 16 / // #77: q2_ := EXPAND(q1_) User #78: q2_ User Simp(#78) 3 2 / 3269321 5828*SQRT(3885) \1/3 #79: x + x - |--------- - -----------------| - \ 19683 2187 / / 5828*SQRT(3885) 3269321 \1/3 2 |----------------- + ---------| - ---- + \ 2187 19683 / 27 2 // 187*SQRT(3) SQRT(1295) \1/3 / 187*SQRT(3) #i*x *||------------- + ------------| - |------------- - \\ 144 16 / \ 144 SQRT(1295) \1/3\ 2 // 187*SQRT(3) SQRT(1295) \1/3 ------------| | + #i*x *||------------- - ------------| - 16 / / \\ 144 16 / / 187*SQRT(3) SQRT(1295) \1/3\ |------------- + ------------| | \ 144 16 / / #80: Precision := Approximate User #81: APPROX(q2_) User 3 2 -5 #82: x + x + 1.42714*10 *x - 7 Simp(#81) #83: Precision := Exact User 100 #84: q_ := x - 1 User #85: FACTOR(q_) User Simp(#85) 2 4 3 2 4 3 2 #86: (x + 1)*(x - 1)*(x + 1)*(x + x + x + x + 1)*(x - x + x - 8 6 4 2 20 15 10 5 20 x + 1)*(x - x + x - x + 1)*(x + x + x + x + 1)*(x 15 10 5 40 30 20 10 - x + x - x + 1)*(x - x + x - x + 1) #87: " Factorization over the complex rationals " User User #88: " => (2 x + 3 i) (2 x - 3 i) (x + 1 + 4 i) (x + 1 - 4 i) " 4 3 2 #89: FACTOR(4*x + 8*x + 77*x + 18*x + 153, Complex) User Simp(#89) #90: (x + 1 + 4*#i)*(x + 1 - 4*#i)*(2*x + 3*#i)*(2*x - 3*#i) #91: " Algebraic extensions " User #92: " => sqrt2 + 1 " User #93: sqrt2 := - SQRT(2) User 1 #94: ----------- User sqrt2 - 1 #95: 1 - SQRT(2) Simp(#94) #96: sqrt2 := SQRT(2) User 1 #97: ----------- User sqrt2 - 1 #98: SQRT(2) + 1 Simp(#97) User #99: " => (x^2 - 2 x - 3)/(x - sqrt2) = (x + 1) (x - 3)/(x - sqrt2) " #100:" [Richard Liska] " User 3 2 x + (sqrt2 - 2)*x - (2*sqrt2 + 3)*x - 3*sqrt2 #101:q_ := -------------------------------------------------User 2 x - 2 #102:q_ User 2 x - 2*x - 3 #103:-------------- Simp(#102) x - SQRT(2) #104:FACTOR(q_) User (x + 1)*(x - 3) #105:----------------- Simp(#104) x - SQRT(2) #106:sqrt2 := User #107:" Multiple algebraic extensions " User #108:sqrt3 := SQRT(3) User 1/3 #109:cbrt2 := 2 User User #110:" => 2 cbrt2 + 8 sqrt3 + 18 cbrt2^2 + 12 cbrt2 sqrt3 + 9 " 4 #111:(cbrt2 + sqrt3) User 1/6 2/3 1/3 #112:12*108 + 18*2 + 8*SQRT(3) + 2*2 + 9 Simp(#111) #113:sqrt3 := User #114:cbrt2 := User User #115:" Factor polynomials over finite fields and field extensions " 4 2 #116:p := x - 3*x + 1 User #117:FACTOR(p) User 2 2 #118:(x + x - 1)*(x - x - 1) Simp(#117) #119:" => (x - 2)^2 (x + 2)^2 mod 5 " User #120:"FACTOR(p) mod 5" User User #121:" => (x^2 + x + 1) (x^9 - x^8 + x^6 - x^5 + x^3 - x^2 + 1) mod 65537 " #122:" [Paul Zimmermann] " User #123:"FACTOR(p) mod 65537" User #124:" => (x - phi) (x + phi) (x - phi + 1) (x + phi - 1) " User User #125:" where phi^2 - phi - 1 = 0 or phi = (1 +- sqrt(5))/2 " #126:FACTOR(p, Complex) User Simp(#126) / SQRT(5) 1 \ / SQRT(5) 1 \ / SQRT(5) #127:|x + --------- + ---|*|x + --------- - ---|*|x - --------- + \ 2 2 / \ 2 2 / \ 2 1 \ / SQRT(5) 1 \ ---|*|x - --------- - ---| 2 / \ 2 2 / #128:p := User 2 3 20 #129:q_ := EXPAND((x - 2*y + 3*z ) ) User Aborted after 1 hour #130:FACTOR(q_) User 2 3 20 #131:q_ := EXPAND((SIN(x) - 2*COS(y) + 3*TAN(z) ) ) User #132:FACTOR(q_) User Simp(#132) 3 2 3 3 20 (SIN(x)*COS(z) - 2*COS(y) *COS(z) + 3*SIN(z) ) #133:---------------------------------------------------- 60 COS(z) User #134:" expand[(1 - c^2)^5 (1 - s^2)^5 (c^2 + s^2)^10] => c^10 s^10 when " User #135:" c^2 + s^2 = 1 [modification of a problem due to Richard Liska] " 2 5 2 5 2 2 10 #136:q_ := EXPAND((1 - c ) *(1 - s ) *(c + s ) ) User #137:" => (x + y) (x - y) mod 3 " User #138:"FACTOR(4*x^2 - 21*x*y + 20*y^2) mod 3" User User #139:" => 1/4 (x + y) (2 x + y [-1 + i sqrt(3)]) (2 x + y [-1 - i sqrt(3)]) " 3 3 #140:FACTOR(x + y , Complex) User Simp(#140) / y SQRT(3)*#i*y \ / y SQRT(3)*#i*y \ #141:(x + y)*|x - --- + --------------|*|x - --- - --------------| \ 2 2 / \ 2 2 / User #142:" Partial fraction decomposition => 3/(x + 2) - 2/(x + 1) + 2/(x + 1)^2 " / 2 \ | x + 2*x + 3 | #143:EXPAND|---------------------| User | 3 2 | \ x + 4*x + 5*x + 2 / 3 2 2 ------- + ---------- - ------- #144: x + 2 2 x + 1 Simp(#143) (x + 1) User #145:" Noncommutative algebra: note that (A B C)^(-1) = C^(-1) B^(-1) A^(-1) " #146:" => A B C A C B - C^(-1) B^(-1) C B " User #147:a :epsilon Nonscalar User #148:a Simp(#147) #149:b :epsilon Nonscalar User #150:b Simp(#149) #151:c :epsilon Nonscalar User #152:c Simp(#151) -1 #153:(a*b*c - (a*b*c) )*a*c*b User Simp(#153) -1 -1 -1 #154:a . b . c . a . c . b - c . b . a . a . c . b User #155:" Jacobi's identity: [A, B, C] + [B, C, A] + [C, A, B] = 0 where [A, B, C] = " User #156:" [A, [B, C]] and [A, B] = A B - B A is the commutator of A and B " #157:COMM2(a, b) := a*b - b*a User #158:COMM3(a, b, c) := COMM2(a, COMM2(b, c)) User #159:COMM2(a, b) User #160:a . b - b . a Simp(#159) #161:COMM3(a, b, c) + COMM3(b, c, a) + COMM3(c, a, b) User #162:0 Simp(#161) #163:comm2 := User #164:comm3 := User #165:a := User #166:b := User #167:c := User #168:" ---------- Quit ---------- " User