RSOLVE.LOG 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ...
  2. % Test file for i_solve and r_solve operators.
  3. % Author: F.J.Wright@Maths.QMW.ac.uk
  4. % Version 1.051, 16 Jan 1995
  5. i_solve((x - 10)*(x + 20)*(x - 30)*(x + 40)*(x - 50));
  6. {x=-20,x=-40,x=50,x=30,x=10}
  7. % {x=-20,x=-40,x=50,x=30,x=10}
  8. i_solve(x^4 - 1, x);
  9. {x=1,x=-1}
  10. % {x=1,x=-1}
  11. i_solve(x^4 + 1);
  12. {}
  13. % {}
  14. r_solve((x^2 - 1)*(x^2 - 9));
  15. {x=1,x=-3,x=3,x=-1}
  16. % {x=1,x=-3,x=3,x=-1}
  17. r_solve(9x^2 - 1);
  18. 1 - 1
  19. {x=---,x=------}
  20. 3 3
  21. % 1 - 1
  22. % {x=---,x=------}
  23. % 3 3
  24. r_solve(9x^2 - 4, x);
  25. - 2 2
  26. {x=------,x=---}
  27. 3 3
  28. % - 2 2
  29. % {x=------,x=---}
  30. % 3 3
  31. r_solve(9x^2 + 16, x);
  32. {}
  33. % {}
  34. r_solve((9x^2 - 16)*(x^2 - 9), x);
  35. - 4 4
  36. {x=------,x=3,x=-3,x=---}
  37. 3 3
  38. % - 4 4
  39. % {x=------,x=3,x=-3,x=---}
  40. % 3 3
  41. % First two examples from Loos' paper:
  42. % ===================================
  43. r_solve(6x^4 - 11x^3 - x^2 - 4);
  44. - 2
  45. {x=------,x=2}
  46. 3
  47. % - 2
  48. % {x=------,x=2}
  49. % 3
  50. r_solve(2x^3 + 12x^2 + 13x + 15);
  51. {x=-5}
  52. % {x=-5}
  53. % Remaining four CORRECTED examples from Loos' paper:
  54. % ==================================================
  55. r_solve(2x^4 - 4x^3 + 3x^2 - 5x - 2);
  56. {x=2}
  57. % {x=2}
  58. r_solve(6x^5 + 11x^4 - x^3 + 5x - 6);
  59. - 3 2
  60. {x=------,x=---}
  61. 2 3
  62. % - 3 2
  63. % {x=------,x=---}
  64. % 2 3
  65. r_solve(x^5 - 5x^4 + 2x^3 - 25x^2 + 21x + 270);
  66. {x=3,x=5,x=-2}
  67. % {x=3,x=5,x=-2}
  68. r_solve(2x^6 + x^5 - 9x^4 - 6x^3 - 5x^2 - 7x + 6);
  69. 1
  70. {x=---,x=-2}
  71. 2
  72. % 1
  73. % {x=---,x=-2}
  74. % 2
  75. % Degenerate equations:
  76. % ====================
  77. i_solve 0;
  78. {}
  79. % {}
  80. i_solve(0, x);
  81. {x=arbint(1)}
  82. % {x=arbint(1)}
  83. r_solve(a = a, x);
  84. {x=arbrat(2)}
  85. % {x=arbrat(2)}
  86. r_solve(x^2 - 1, y);
  87. {}
  88. % {}
  89. % Test of options and multiplicity:
  90. % ================================
  91. i_solve(x^4 - 1, x, noeqs);
  92. {1,-1}
  93. % {1,-1}
  94. i_solve((x^4 - 1)^3, x);
  95. {x=1,x=-1}
  96. % {x=1,x=-1}
  97. root_multiplicities;
  98. {3,3}
  99. % {3,3}
  100. on multiplicities;
  101. i_solve((x^4 - 1)^3, x);
  102. {x=1,x=1,x=1,x=-1,x=-1,x=-1}
  103. % {x=1,x=1,x=1,x=-1,x=-1,x=-1}
  104. root_multiplicities;
  105. {}
  106. % {}
  107. i_solve((x^4 - 1)^3, x, separate);
  108. {x=1,x=-1}
  109. % {x=1,x=-1}
  110. root_multiplicities;
  111. {3,3}
  112. % {3,3}
  113. off multiplicities;
  114. i_solve((x^4 - 1)^3, x, multiplicities);
  115. {x=1,x=1,x=1,x=-1,x=-1,x=-1}
  116. % {x=1,x=1,x=1,x=-1,x=-1,x=-1}
  117. root_multiplicities;
  118. {}
  119. % {}
  120. i_solve((x^4 - 1)^3, x, expand, noeqs);
  121. {1,1,1,-1,-1,-1}
  122. % {1,1,1,-1,-1,-1}
  123. root_multiplicities;
  124. {}
  125. % {}
  126. i_solve((x^4 - 1)^3, x, together);
  127. {{x=1,3},{x=-1,3}}
  128. % {{x=1,3},{x=-1,3}}
  129. root_multiplicities;
  130. {}
  131. % {}
  132. i_solve((x^4 - 1)^3, x, together, noeqs);
  133. {{1,3},{-1,3}}
  134. % {{1,3},{-1,3}}
  135. root_multiplicities;
  136. {}
  137. % {}
  138. i_solve((x^4 - 1)^3, x, nomul);
  139. {x=-1,x=1}
  140. % {x=-1,x=1}
  141. root_multiplicities;
  142. {}
  143. % {}
  144. % Test of error handling:
  145. % ======================
  146. on errcont;
  147. r_solve();
  148. ***** r/i_solve called with no equations
  149. % ***** r/i_solve called with no equations
  150. r_solve(x^2 - a, x);
  151. 2
  152. ***** - a + x invalid as univariate polynomial over Z
  153. % 2
  154. % ***** - a + x invalid as univariate polynomial over Z
  155. r_solve(x^2 - 1, x, foo);
  156. ***** foo invalid as optional r/i_solve argument
  157. % ***** foo invalid as optional r/i_solve argument
  158. r_solve({x^2 - 1}, x);
  159. 2
  160. ***** {x - 1} invalid as univariate polynomial over Z
  161. % 2
  162. % ***** {x - 1} invalid as univariate polynomial over Z
  163. on complex;
  164. i_solve((x-1)*(x-i), x);
  165. 2
  166. ***** - i*x + i + x - x invalid as univariate polynomial over Z
  167. % 2
  168. % ***** - i*x + i + x - x invalid as univariate polynomial over Z
  169. end$
  170. (TIME: rsolve 290 320)