solve.tst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. % Demonstration of the REDUCE SOLVE package.
  2. % Simultaneous linear fractional equations.
  3. solve({(a*x+y)/(z-1)-3,y+b+z,x-y},{x,y,z});
  4. % Use of square-free factorization together with recursive use of
  5. % quadratic and binomial solutions.
  6. solve((x**6-x**3-1)*(x**5-1)**2*x**2);
  7. multiplicities!*;
  8. % A singular equation without and with a consistent inhomogeneous term.
  9. solve(a,x);
  10. solve(0,x);
  11. off solvesingular;
  12. solve(0,x);
  13. % Use of DECOMPOSE to solve high degree polynomials.
  14. solve(x**8-8*x**7+34*x**6-92*x**5+175*x**4-236*x**3+226*x**2-140*x+46);
  15. solve(x**8-88*x**7+2924*x**6-43912*x**5+263431*x**4-218900*x**3+
  16. 65690*x**2-7700*x+234,x);
  17. % Recursive use of inverses, including multiple branches of rational
  18. % fractional powers.
  19. solve(log(acos(asin(x**(2/3)-b)-1))+2,x);
  20. % Square-free factors that are unsolvable, being of fifth degree,
  21. % transcendental, or without a defined inverse.
  22. operator f;
  23. solve((x-1)*(x+1)*(x-2)*(x+2)*(x-3)*(x*log(x)-1)*(f(x)-1),x);
  24. multiplicities!*;
  25. % Factors with more than one distinct top-level kernel, the first factor
  26. % requiring the cubic formula. (SOLVE also uses the quartic formula, but
  27. % the output is usually unavoidably too messy to be of much use).
  28. solve((x**(1/2)-(x-a)**(1/3))*(acos x-acos(2*x-b))* (2*log x
  29. -log(x**2+x-c)-4),x);
  30. % Treatment of multiple-argument exponentials as polynomials.
  31. solve(a**(2*x)-3*a**x+2,x);
  32. % A 12th degree reciprocal polynomial that is irreductible over the
  33. % integers, having a reduced polynomial that is also reciprocal.
  34. % (Reciprocal polynomials are those that have symmetric or antisymmetric
  35. % coefficient patterns.) We also demonstrate suppression of automatic
  36. % integer root extraction.
  37. solve(x**12-4*x**11+12*x**10-28*x**9+45*x**8-68*x**7+69*x**6-68*x**5+
  38. 45*x**4-28*x**3+12*x**2-4*x+1);
  39. % The treatment of factors with non-unique inverses by introducing
  40. % unique new real or integer indeterminant kernels.
  41. solve((sin x-a)*(2**x-b)*(x**c-3),x);
  42. % Automatic restriction to principal branches.
  43. off allbranch;
  44. solve((sin x-a)*(2**x-b)*(x**c-3),x);
  45. % Regular system of linear equations.
  46. solve({2*x1+x2+3*x3-9,x1-2*x2+x3+2,3*x1+2*x2+2*x3-7}, {x1,x2,x3});
  47. % Underdetermined system of linear equations.
  48. on solvesingular;
  49. solve({x1-4*x2+2*x3+1,2*x1-3*x2-x3-5*x4+7,3*x1-7*x2+x3-5*x4+8},
  50. {x1,x2,x3,x4});
  51. % Inconsistent system of linear equations.
  52. solve({2*x1+3*x2-x3-2,7*x1+4*x2+2*x3-8,3*x1-2*x2+4*x3-5},
  53. {x1,x2,x3});
  54. % Overdetermined system of linear equations.
  55. solve({x1-x2+x3-12,2*x1+3*x2-x3-13,3*x2+4*x3-5,-3*x1+x2+4*x3+20},
  56. {x1,x2,x3});
  57. % Degenerate system of linear equations.
  58. operator xx,yy;
  59. yy(1) := -a**2*b**3-3*a**2*b**2-3*a**2*b+a**2*(xx(3)-2)-a*b-a*c+a*(xx(2)
  60. -xx(5))-xx(4)-xx(5)+xx(1)-1;
  61. yy(2) := -a*b**3-b**5+b**4*(-xx(4)-xx(5)+xx(1)-5)-b**3*c+b**3*(xx(2)
  62. -xx(5)-3)+b**2*(xx(3)-1);
  63. yy(3) := -a*b**3*c-3*a*b**2*c-4*a*b*c+a*b*(-xx(4)-xx(5)+xx(1)-1)
  64. +a*c*(xx(3)-1)-b**2*c-b*c**2+b*c*(xx(2)-xx(5));
  65. yy(4) := -a**2-a*c+a*(xx(2)-xx(4)-2*xx(5)+xx(1)-1)-b**4-b**3*c-3*b**3
  66. -3*b**2*c-2*b**2-2*b*c+b*(xx(3)-xx(2)-xx(4)+xx(1)-2)
  67. +c*(xx(3)-1);
  68. yy(5) := -2*a-3*b**3-9*b**2-11*b-2*c+3*xx(3)+2*xx(2)-xx(4)-3*xx(5)+xx(1)
  69. -4;
  70. soln := solve({yy(1),yy(2),yy(3),yy(4),yy(5)},
  71. {xx(1),xx(2),xx(3),xx(4),xx(5)});
  72. for i := 1:5 do xx(i) := part(soln,1,i,2);
  73. for i := 1:5 do write yy(i);
  74. % Single equations liftable to polynomial systems.
  75. solve ({a*sin x + b*cos x},{x});
  76. solve ({a*sin(x+1) + b*cos(x+1)},{x});
  77. % Intersection of 2 curves: system with a free parameter.
  78. solve ({sqrt(x^2 + y^2)=r,0=sqrt(x)+ y**3-1},{x,y,r});
  79. % Not yet soluble.
  80. solve ({e^x - e^(1/2 * x) - 7},{x});
  81. % Generally not liftable.
  82. % variable inside and outside of sin.
  83. solve({sin x + x - 1/2},{x});
  84. % Variable inside and outside of exponential.
  85. solve({e^x - x**2},{x});
  86. % Variable inside trigonometrical functions with different forms.
  87. solve ({a*sin(x+1) + b*cos(x+2)},{x});
  88. % Undetermined exponents.
  89. solve({x^a - 2},{x});
  90. % Example taken from M.L. Griss, ACM Trans. Math. Softw. 2 (1976) 1.
  91. e1 := x1 - l/(3*k)$
  92. e2 := x2 - 1$
  93. e3 := x3 - 35*b6/(6*l)*x4 + 33*b11/(2*l)*x6 - 715*b15/(14*l)*x8$
  94. e4 := 14*k/(3*l)*x1 - 7*b4/(2*l)*x3 + x4$
  95. e5 := x5 - 891*b11/(40*l)*x6 +3861*b15/(56*l)*x8$
  96. e6 := -88*k/(15*l)*x1 + 22*b4/(5*l)*x3 - 99*b9/(8*l)*x5 +x6$
  97. e7 := -768*k/(5005*b13)*x1 + 576*b4/(5005*b13)*x3 -
  98. 324*b9/(1001*b13)*x5 + x7 - 16*l/(715*b13)*x8$
  99. e8 := 7*l/(143*b15)*x1 + 49*b6/(429*b15)*x4 - 21*b11/(65*b15)*x6 +
  100. x8 - 7*b2/(143*b15)$
  101. solve({e1,e2,e3,e4,e5,e6,e7,e8},{x1,x2,x3,x4,x5,x6,x7,x8});
  102. f1 := x1 - x*x2 - y*x3 + 1/2*x**2*x4 + x*y*x5 + 1/2*y**2*x6 +
  103. 1/6*x**3*x7 + 1/2*x*y*(x - y)*x8 - 1/6*y**3*x9$
  104. f2 := x1 - y*x3 + 1/2*y**2*x6 - 1/6*y**3*x9$
  105. f3 := x1 + y*x2 - y*x3 + 1/2*y**2*x4 - y**2*x5 + 1/2*y**2*x6 +
  106. 1/6*y**3*x7 + 1/2*y**3*x8 - 1/6*y**3*x9$
  107. f4 := x1 + (1 - x)*x2 - x*x3 + 1/2*(1 - x)**2*x4 - y*(1 - x)*x5 +
  108. 1/2*y**2*x6 + 1/6*(1 - x)**3*x7 + 1/2*y*(1 - x - y)*(1 - x)*x8
  109. - 1/6*y**3*x9$
  110. f5 := x1 + (1 - x - y)*x2 + 1/2*(1 - x - y)**2*x4 +
  111. 1/6*(1 - x - y)**3*x7$
  112. f6 := x1 + (1 - x - y)*x3 + 1/2*(1 - x - y)*x6 +
  113. 1/6*(1 - x - y)**3*x9$
  114. f7 := x1 - x*x2 + (1 - y)*x3 + 1/2*x*x4 - x*(1 - y)*x5 +
  115. 1/2*(1 - y)**2*x6 - 1/6*x**3*x7 + 1/2*x*(1 - y)*(1 - y + x)*x8
  116. + 1/6*(1-y)**3*x9$
  117. f8 := x1 - x*x2 + x*x3 + 1/2*x**2*x4 - x**2*x5 + 1/2*x**2*x6 +
  118. 1/6*x**3*x7 - 1/2*x**3*x8 + 1/6*x**3*x9$
  119. f9 := x1 - x*x2 + 1/2*x**2*x4 + 1/6*x**3*x7$
  120. solve({f1,f2,f3,f4,f5,f6,f7,f8,f9},{x1,x2,x3,x4,x5,x6,x7,x8,x9});
  121. solve({f1 - 1,f2,f3,f4,f5,f6,f7,f8,f9},{x1,x2,x3,x4,x5,x6,x7,x8,x9});
  122. % The following examples were discussed in Char, B.W., Fee, G.J.,
  123. % Geddes, K.O., Gonnet, G.H., Monagan, M.B., Watt, S.M., "On the
  124. % Design and Performance of the Maple System", Proc. 1984 Macsyma
  125. % Users' Conference, G.E., Schenectady, NY, 1984, 199-219.
  126. % Problem 1.
  127. solve({ -22319*x0+25032*x1-83247*x2+67973*x3+54189*x4
  128. -67793*x5+81135*x6+22293*x7+27327*x8+96599*x9-15144,
  129. 79815*x0+37299*x1-28495*x2-52463*x3+25708*x4 -55333*x5-
  130. 2742*x6+83127*x7-29417*x8-43202*x9+93314, -29065*x0-77803*x1-
  131. 49717*x2-64748*x3-68324*x4 -50162*x5-64222*x6-
  132. 4716*x7+30737*x8+22971*x9+90348, 62470*x0+59658*x1-
  133. 46120*x2+58376*x3-28208*x4 -74506*x5+28491*x6+21099*x7+29149*x8-
  134. 20387*x9+36254, -98233*x0-26263*x1-63227*x2+34307*x3+92294*x4
  135. +10148*x5+3192*x6+24044*x7-83764*x8-1121*x9+13871,
  136. -20427*x0+62666*x1+27330*x2-78670*x3+9036*x4 +56024*x5-4525*x6-
  137. 50589*x7-62127*x8-32846*x9+38466,
  138. -85609*x0+5424*x1+86992*x2+59651*x3-60859*x4 -55984*x5-
  139. 6061*x6+44417*x7+92421*x8+6701*x9-9459,
  140. -68255*x0+19652*x1+92650*x2-93032*x3-30191*x4 -31075*x5-
  141. 89060*x6+12150*x7-78089*x8-12462*x9+1027, 55526*x0-
  142. 91202*x1+91329*x2-25919*x3-98215*x4 +30554*x5+913*x6-
  143. 35751*x7+17948*x8-58850*x9+66583, 40612*x0+84364*x1-
  144. 83317*x2+10658*x3+37213*x4 +50489*x5+72040*x6-
  145. 21227*x7+60772*x8+95114*x9-68533});
  146. solve({ -22319*x0+25032*x1-83247*x2+67973*x3+54189*x4
  147. -67793*x5+81135*x6+22293*x7+27327*x8+96599*x9-15144,
  148. 79815*x0+37299*x1-28495*x2-52463*x3+25708*x4 -55333*x5-
  149. 2742*x6+83127*x7-29417*x8-43202*x9+93314, -29065*x0-77803*x1-
  150. 49717*x2-64748*x3-68324*x4 -50162*x5-64222*x6-
  151. 4716*x7+30737*x8+22971*x9+90348, 62470*x0+59658*x1-
  152. 46120*x2+58376*x3-28208*x4-74506*x5+28491*x6+21099*x7+29149*x8-
  153. 20387*x9+36254,-98233*x0-26263*x1-63227*x2+34307*x3+92294*x4
  154. +10148*x5+3192*x6+24044*x7-83764*x8-1121*x9+13871,
  155. -20427*x0+62666*x1+27330*x2-78670*x3+9036*x4 +56024*x5-4525*x6-
  156. 50589*x7-62127*x8-32846*x9+38466,
  157. -85609*x0+5424*x1+86992*x2+59651*x3-60859*x4 -55984*x5-
  158. 6061*x6+44417*x7+92421*x8+6701*x9-9459,
  159. -68255*x0+19652*x1+92650*x2-93032*x3-30191*x4 -31075*x5-
  160. 89060*x6+12150*x7-78089*x8-12462*x9+1027, 55526*x0-
  161. 91202*x1+91329*x2-25919*x3-98215*x4 +30554*x5+913*x6-
  162. 35751*x7+17948*x8-58850*x9+66583, 40612*x0+84364*x1-
  163. 83317*x2+10658*x3+37213*x4 +50489*x5+72040*x6-
  164. 21227*x7+60772*x8+95114*x9-68533});
  165. % The next two problems give the current routines some trouble and
  166. % have therefore been commented out.
  167. % Problem 2.
  168. comment
  169. solve({ 81*x30-96*x21-45, -36*x4+59*x29+26,
  170. -59*x26+5*x3-33, -81*x19-92*x23-21*x17-9, -46*x29-
  171. 13*x22+22*x24+83, 47*x4-47*x14-15*x26-40, 83*x30+70*x17+56*x10-
  172. 31, 10*x27-90*x9+52*x21+52, -33*x20-97*x26+20*x6-76,
  173. 97*x16+41*x8-13*x12+66, 16*x16-52*x10-73*x28+49, -28*x1-53*x24-
  174. x27-67, -22*x26-29*x24+73*x10+8, 88*x18+61*x19-98*x9-55, 99*x28-
  175. 91*x26+26*x21-95, -6*x18+25*x7-77*x2+99, 28*x13-50*x17-52*x14-64,
  176. -50*x20+26*x11+93*x2+77, -70*x8+74*x19-94*x26+86, -18*x18-2*x16-
  177. 79*x23+91, 36*x26-13*x11-53*x25-5, 10*x7+57*x16-85*x10-14,
  178. -3*x27+44*x4+52*x22-1, 21*x11+20*x25-30*x4-83, 70*x2-97*x19-
  179. 41*x26-50, -51*x8+95*x12-85*x26+45, 83*x30+41*x12+50*x2+53,
  180. -4*x26+69*x8-58*x5-95, 59*x27-78*x30-66*x23+16, -10*x20-36*x11-
  181. 60*x1-59});
  182. % Problem 3.
  183. comment
  184. solve({ 115*x40+566*x41-378*x42+11401086415/6899901,
  185. 560*x0-45*x1-506*x2-11143386403/8309444, -621*x1-
  186. 328*x2+384*x3+1041841/64675, -856*x2+54*x3+869*x4-41430291/24700,
  187. 596*x3-608*x4-560*x5-10773384/11075,
  188. -61*x4+444*x5+924*x6+4185100079/11278780, 67*x5-95*x6-
  189. 682*x7+903866812/6618863, 196*x6+926*x7-930*x8-
  190. 2051864151/2031976, -302*x7-311*x8-890*x9-14210414139/27719792,
  191. 121*x8-781*x9-125*x10-4747129093/39901584, 10*x9+555*x10-
  192. 912*x11+32476047/3471829, -151*x38+732*x39-
  193. 397*x40+327281689/173242, 913*x10-259*x11-982*x12-
  194. 18080663/5014020, 305*x11+9*x12-357*x13+1500752933/1780680,
  195. 179*x12-588*x13+665*x14+8128189/51832, 406*x13+843*x14-
  196. 833*x15+201925713/97774, 107*x14+372*x15+505*x16-
  197. 5161192791/3486415, 720*x15-212*x16+607*x17-31529295571/7197760,
  198. 951*x16-685*x17+148*x18+1034546543/711104, -654*x17-
  199. 899*x18+543*x19+1942961717/1646560,
  200. -448*x18+673*x19+702*x20+856422818/1286375, 396*x19-
  201. 196*x20+218*x21-4386267866/21303625, -233*x20-796*x21-373*x22-
  202. 85246365829/57545250, 921*x21-368*x22+730*x23-
  203. 93446707622/51330363, -424*x22+378*x23+727*x24-
  204. 6673617931/3477462, -633*x23+565*x24-208*x25+8607636805/4092942,
  205. 971*x24+170*x25-865*x26-25224505/18354, 937*x25+333*x26-463*x27-
  206. 339307103/1025430, 494*x26-8*x27-50*x28+57395804/34695,
  207. 530*x27+631*x28-193*x29-8424597157/680022,
  208. -435*x28+252*x29+916*x30+196828511/19593, 327*x29+403*x30-
  209. 845*x31+8458823325/5927971, 246*x30+881*x31-
  210. 394*x32+13624765321/156546826, 946*x31+169*x32-43*x33-
  211. 53594199271/126093183, -146*x32+503*x33-
  212. 363*x34+66802797635/15234909, -132*x33-
  213. 686*x34+376*x35+8167530636/902635, -38*x34-188*x35-
  214. 583*x36+1814153743/1124240, 389*x35+562*x36-688*x37-
  215. 12251043951/5513560, -769*x37-474*x38-89*x39-2725415872/1235019,
  216. -625*x36-122*x37+468*x38+7725682775/4506736,
  217. 839*x39+936*x40+703*x41+1912091857/1000749,
  218. -314*x41+102*x42+790*x43+7290073150/8132873, -905*x42-
  219. 454*x43+524*x44-10110944527/4538233, 379*x43+518*x44-328*x45-
  220. 2071620692/519645, 284*x44-979*x45+690*x46-915987532/16665,
  221. 198*x45-650*x46-763*x47+548801657/11220, 974*x46+12*x47+410*x48-
  222. 3831097561/51051, -498*x47-135*x48-230*x49-18920705/9282,
  223. 665*x48+156*x49+34*x0-27714736/156585, -519*x49-366*x0-730*x1-
  224. 2958446681/798985});
  225. % Problem 4.
  226. solve({ -b*k8/a+c*k8/a, -b*k11/a+c*k11/a,
  227. -b*k10/a+c*k10/a+k2,
  228. -k3-b*k9/a+c*k9/a, -b*k14/a+c*k14/a, -b*k15/a+c*k15/a,
  229. -b*k18/a+c*k18/a-k2, -b*k17/a+c*k17/a, -b*k16/a+c*k16/a+k4,
  230. -b*k13/a+c*k13/a-b*k21/a+c*k21/a+b*k5/a-c*k5/a,
  231. b*k44/a-c*k44/a, -b*k45/a+c*k45/a, -b*k20/a+c*k20/a,
  232. -b*k44/a+c*k44/a, b*k46/a-c*k46/a,
  233. b**2*k47/a**2-2*b*c*k47/a**2+c**2*k47/a**2,
  234. k3, -k4, -b*k12/a+c*k12/a-a*k6/b+c*k6/b,
  235. -b*k19/a+c*k19/a+a*k7/c-b*k7/c, b*k45/a-c*k45/a,
  236. -b*k46/a+c*k46/a, -k48+c*k48/a+c*k48/b-c**2*k48/(a*b),
  237. -k49+b*k49/a+b*k49/c-b**2*k49/(a*c), a*k1/b-c*k1/b,
  238. a*k4/b-c*k4/b, a*k3/b-c*k3/b+k9, -k10+a*k2/b-c*k2/b,
  239. a*k7/b-c*k7/b, -k9, k11, b*k12/a-c*k12/a+a*k6/b-c*k6/b,
  240. a*k15/b-c*k15/b, k10+a*k18/b-c*k18/b,
  241. -k11+a*k17/b-c*k17/b, a*k16/b-c*k16/b,
  242. -a*k13/b+c*k13/b+a*k21/b-c*k21/b+a*k5/b-c*k5/b,
  243. -a*k44/b+c*k44/b, a*k45/b-c*k45/b,
  244. a*k14/c-b*k14/c+a*k20/b-c*k20/b, a*k44/b-c*k44/b,
  245. -a*k46/b+c*k46/b, -k47+c*k47/a+c*k47/b-c**2*k47/(a*b),
  246. a*k19/b-c*k19/b, -a*k45/b+c*k45/b, a*k46/b-c*k46/b,
  247. a**2*k48/b**2-2*a*c*k48/b**2+c**2*k48/b**2,
  248. -k49+a*k49/b+a*k49/c-a**2*k49/(b*c), k16, -k17,
  249. -a*k1/c+b*k1/c, -k16-a*k4/c+b*k4/c, -a*k3/c+b*k3/c,
  250. k18-a*k2/c+b*k2/c, b*k19/a-c*k19/a-a*k7/c+b*k7/c,
  251. -a*k6/c+b*k6/c, -a*k8/c+b*k8/c, -a*k11/c+b*k11/c+k17,
  252. -a*k10/c+b*k10/c-k18, -a*k9/c+b*k9/c,
  253. -a*k14/c+b*k14/c-a*k20/b+c*k20/b,
  254. -a*k13/c+b*k13/c+a*k21/c-b*k21/c-a*k5/c+b*k5/c,
  255. a*k44/c-b*k44/c, -a*k45/c+b*k45/c, -a*k44/c+b*k44/c,
  256. a*k46/c-b*k46/c, -k47+b*k47/a+b*k47/c-b**2*k47/(a*c),
  257. -a*k12/c+b*k12/c, a*k45/c-b*k45/c, -a*k46/c+b*k46/c,
  258. -k48+a*k48/b+a*k48/c-a**2*k48/(b*c),
  259. a**2*k49/c**2-2*a*b*k49/c**2+b**2*k49/c**2, k8, k11, -k15,
  260. k10-k18, -k17, k9, -k16, -k29, k14-k32, -k21+k23-k31,
  261. -k24-k30, -k35, k44, -k45, k36, k13-k23+k39, -k20+k38,
  262. k25+k37, b*k26/a-c*k26/a-k34+k42, -2*k44, k45, k46,
  263. b*k47/a-c*k47/a, k41, k44, -k46, -b*k47/a+c*k47/a,
  264. k12+k24, -k19-k25, -a*k27/b+c*k27/b-k33, k45, -k46,
  265. -a*k48/b+c*k48/b, a*k28/c-b*k28/c+k40, -k45, k46,
  266. a*k48/b-c*k48/b, a*k49/c-b*k49/c, -a*k49/c+b*k49/c,
  267. -k1, -k4, -k3, k15, k18-k2, k17, k16, k22, k25-k7,
  268. k24+k30, k21+k23-k31, k28, -k44, k45, -k30-k6, k20+k32,
  269. k27+b*k33/a-c*k33/a, k44, -k46, -b*k47/a+c*k47/a, -k36,
  270. k31-k39-k5, -k32-k38, k19-k37, k26-a*k34/b+c*k34/b-k42,
  271. k44, -2*k45, k46, a*k48/b-c*k48/b, a*k35/c-b*k35/c-k41,
  272. -k44, k46, b*k47/a-c*k47/a, -a*k49/c+b*k49/c, -k40, k45,
  273. -k46, -a*k48/b+c*k48/b, a*k49/c-b*k49/c, k1, k4, k3, -k8,
  274. -k11, -k10+k2, -k9, k37+k7, -k14-k38, -k22, -k25-k37, -k24+k6,
  275. -k13-k23+k39, -k28+b*k40/a-c*k40/a, k44, -k45, -k27, -k44,
  276. k46, b*k47/a-c*k47/a, k29, k32+k38, k31-k39+k5, -k12+k30,
  277. k35-a*k41/b+c*k41/b, -k44, k45, -k26+k34+a*k42/c-b*k42/c,
  278. k44, k45, -2*k46, -b*k47/a+c*k47/a, -a*k48/b+c*k48/b,
  279. a*k49/c-b*k49/c, k33, -k45, k46, a*k48/b-c*k48/b,
  280. -a*k49/c+b*k49/c },
  281. {k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14,
  282. k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26,
  283. k27, k28, k29, k30, k31, k32, k33, k34, k35, k36, k37, k38,
  284. k39, k40, k41, k42, k43, k44, k45, k46, k47, k48, k49});
  285. % Problem 5.
  286. solve ({2*a3*b3+a5*b3+a3*b5, a5*b3+2*a5*b5+a3*b5,
  287. a5*b5, a2*b2, a4*b4, a5*b1+b5+a4*b3+a3*b4,
  288. a5*b3+a5*b5+a3*b5+a3*b3, a0*b2+b2+a4*b2+a2*b4+c2+a2*b0+a2*b1,
  289. a0*b0+a0*b1+a0*b4+a3*b2+b0+b1+b4+a4*b0+a4*b1+a2*b5+a4*b4+c1+c4
  290. +a5*b2+a2*b3+c0,
  291. -1+a3*b0+a0*b3+a0*b5+a5*b0+b3+b5+a5*b4+a4*b3+a4*b5+a3*b4+a5*b1
  292. +a3*b1+c3+c5,
  293. b4+a4*b1, a5*b3+a3*b5, a2*b1+b2, a4*b5+a5*b4, a2*b4+a4*b2,
  294. a0*b5+a5*b0+a3*b4+2*a5*b4+a5*b1+b5+a4*b3+2*a4*b5+c5,
  295. a4*b0+2*a4*b4+a2*b5+b4+a4*b1+a5*b2+a0*b4+c4,
  296. c3+a0*b3+2*b3+b5+a4*b3+a3*b0+2*a3*b1+a5*b1+a3*b4,
  297. c1+a0*b1+2*b1+a4*b1+a2*b3+b0+a3*b2+b4});
  298. % Problem 6.
  299. solve({2*a3*b3+a5*b3+a3*b5, a5*b3+2*a5*b5+a3*b5,
  300. a4*b4, a5*b3+a5*b5+a3*b5+a3*b3, b1, a3*b3, a2*b2, a5*b5,
  301. a5*b1+b5+a4*b3+a3*b4, a0*b2+b2+a4*b2+a2*b4+c2+a2*b0+a2*b1,
  302. b4+a4*b1, b3+a3*b1, a5*b3+a3*b5, a2*b1+b2, a4*b5+a5*b4,
  303. a2*b4+a4*b2, a0*b0+a0*b1+a0*b4+a3*b2+b0+b1+b4+a4*b0+a4*b1
  304. +a2*b5+a4*b4+c1+c4+a5*b2+a2*b3+c0,-1+a3*b0+a0*b3+a0*b5+a5*b0
  305. +b3+b5+a5*b4+a4*b3+a4*b5+a3*b4+a5*b1+a3*b1+c3+c5,
  306. a0*b5+a5*b0+a3*b4+2*a5*b4+a5*b1+b5+a4*b3+2*a4*b5+c5,
  307. a4*b0+2*a4*b4+a2*b5+b4+a4*b1+a5*b2+a0*b4+c4,
  308. c3+a0*b3+2*b3+b5+a4*b3+a3*b0+2*a3*b1+a5*b1+a3*b4,
  309. c1+a0*b1+2*b1+a4*b1+a2*b3+b0+a3*b2+b4});
  310. % Example cited by Bruno Buchberger
  311. % in R.Janssen: Trends in Computer Algebra,
  312. % Springer, 1987
  313. % Geometry of a simple robot,
  314. % l1,l2 length of arms
  315. % ci,si cos and sin of rotation angles
  316. solve( { c1*c2 -cf*ct*cp + sf*sp,
  317. s1*c2 - sf*ct*cp - cf*sp,
  318. s2 + st*cp,
  319. -c1*s2 - cf*ct*sp + sf*cp,
  320. -s1*s2 + sf*ct*sp - cf*cp,
  321. c2 - st*sp,
  322. s1 - cf*st,
  323. -c1 - sf*st,
  324. ct,
  325. l2*c1*c2 - px,
  326. l2*s1*c2 - py,
  327. l2*s2 + l1 - pz,
  328. c1**2 + s1**2 -1,
  329. c2**2 + s2**2 -1,
  330. cf**2 + sf**2 -1,
  331. ct**2 + st**2 -1,
  332. cp**2 + sp**2 -1},
  333. {c1,c2,s1,s2,py,cf,ct,cp,sf,st,sp});
  334. % Steady state computation of a prototypical chemical
  335. % reaction network (the "Edelstein" network)
  336. solve(
  337. { alpha * c1 - beta * c1**2 - gamma*c1*c2 + epsilon*c3,
  338. -gamma*c1*c2 + (epsilon+theta)*c3 -eta *c2,
  339. gamma*c1*c2 + eta*c2 - (epsilon+theta) * c3},
  340. {c3,c2,c1});
  341. solve(
  342. {( - 81*y1**2*y2**2 + 594*y1**2*y2 - 225*y1**2 + 594*y1*y2**2 - 3492*
  343. y1*y2 - 750*y1 - 225*y2**2 - 750*y2 + 14575)/81,
  344. ( - 81*y2**2*y3**2 + 594*y2**2*y3 - 225*y2**2 + 594*y2*y3**2 - 3492*
  345. y2*y3 - 750*y2 - 225*y3**2 - 750*y3 + 14575)/81,
  346. ( - 81*y1**2*y3**2 + 594*y1**2*y3 - 225*y1**2 + 594*y1*y3**2 - 3492*
  347. y1*y3 - 750*y1 - 225*y3**2 - 750*y3 + 14575)/81,
  348. (2*(81*y1**2*y2**2*y3 + 81*y1**2*y2*y3**2 - 594*y1**2*y2*y3 - 225*y1
  349. **2*y2 - 225*y1**2*y3 + 1650*y1**2 + 81*y1*y2**2*y3**2 - 594*y1*
  350. y2**2*y3 - 225*y1*y2**2 - 594*y1*y2*y3**2 + 2592*y1*y2*y3 + 2550
  351. *y1*y2 - 225*y1*y3**2 + 2550*y1*y3 - 3575*y1 - 225*y2**2*y3 +
  352. 1650*y2**2 - 225*y2*y3**2 + 2550*y2*y3 - 3575*y2 + 1650*y3**2 -
  353. 3575*y3 - 30250))/81}, {y1,y2,y3,y4});
  354. end;