ARNUM.LOG 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ...
  2. % Test of algebraic number package.
  3. defpoly sqrt2**2-2;
  4. 1/(sqrt2+1);
  5. sqrt2 - 1
  6. (x**2+2*sqrt2*x+2)/(x+sqrt2);
  7. x + sqrt2
  8. on gcd;
  9. (x**3+(sqrt2-2)*x**2-(2*sqrt2+3)*x-3*sqrt2)/(x**2-2);
  10. 2
  11. x - 2*x - 3
  12. --------------
  13. x - sqrt2
  14. off gcd;
  15. sqrt(x**2-2*sqrt2*x*y+2*y**2);
  16. abs(x - sqrt2*y)
  17. off arnum;
  18. %to start a new algebraic extension.
  19. defpoly cbrt5**3-5;
  20. on rationalize;
  21. 1/(x-cbrt5);
  22. 2 2
  23. x + cbrt5*x + cbrt5
  24. -----------------------
  25. 3
  26. x - 5
  27. off rationalize;
  28. off arnum;
  29. %to start a new algebraic extension.
  30. %The following examples are taken from P.S. Wang Math. Comp. 30,
  31. % 134,(1976),p.324.
  32. on factor;
  33. defpoly i**2+1=0;
  34. w0 := x**2+1;
  35. w0 := (x + i)*(x - i)
  36. w1 := x**4-1;
  37. w1 := (x + i)*(x - i)*(x + 1)*(x - 1)
  38. w2 := x**4+(i+2)*x**3+(2*i+5)*x**2+(2*i+6)*x+6;
  39. 2
  40. w2 := (x + i*x + 3)*(x + i + 1)*(x - (i - 1))
  41. w3 := (2*i+3)*x**4+(3*i-2)*x**3-2*(i+1)*x**2+i*x-1;
  42. 2 2 2 3
  43. w3 := (2*i + 3)*(x + i*x - 1)*(x - (----*i - ----))
  44. 13 13
  45. off arnum;
  46. defpoly a**2-5;
  47. w4 := x**2+x-1;
  48. 1 1 1 1
  49. w4 := (x + ---*a + ---)*(x - (---*a - ---))
  50. 2 2 2 2
  51. off arnum;
  52. defpoly a**2+a+2;
  53. w5 := x**4+3*x**2+4;
  54. w5 := (x + a + 1)*(x + a)*(x - (a + 1))*(x - a)
  55. off arnum;
  56. defpoly a**3+2=0;
  57. w6:=64*x**6-4;
  58. 2 1 1 2 2 1 1 2 1 1
  59. w6 := 64*(x + ---*a*x + ---*a )*(x - ---*a*x + ---*a )*(x + ---*a)*(x - ---*a)
  60. 2 4 2 4 2 2
  61. off arnum;
  62. defpoly a**4+a**3+a**2+a+1=0;
  63. w7:=16*x**4+8*x**3+4*x**2+2*x+1;
  64. w7 :=
  65. 1 3 1 2 1 1 1 3 1 2 1
  66. 16*(x + ---*a + ---*a + ---*a + ---)*(x - ---*a )*(x - ---*a )*(x - ---*a)
  67. 2 2 2 2 2 2 2
  68. off arnum, factor;
  69. defpoly sqrt5**2-5,cbrt3**3-3;
  70. *** Defining polynomial for primitive element:
  71. 6 4 3 2
  72. a1 - 15*a1 - 6*a1 + 75*a1 - 90*a1 - 116
  73. cbrt3**3;
  74. 3
  75. sqrt5**2;
  76. 5
  77. cbrt3;
  78. 120 5 27 4 2000 3 1170 2 6676 6825
  79. - (------*a1 + ------*a1 - ------*a1 - ------*a1 + ------*a1 - ------)
  80. 8243 8243 8243 8243 8243 8243
  81. sqrt5;
  82. 120 5 27 4 2000 3 1170 2 14919 6825
  83. ------*a1 + ------*a1 - ------*a1 - ------*a1 + -------*a1 - ------
  84. 8243 8243 8243 8243 8243 8243
  85. sqrt(x**2+2*(sqrt5-cbrt3)*x+5-2*sqrt5*cbrt3+cbrt3**2);
  86. 240 5 54 4 4000 3 2340 2 21595 13650
  87. abs(x + ------*a1 + ------*a1 - ------*a1 - ------*a1 + -------*a1 - -------
  88. 8243 8243 8243 8243 8243 8243
  89. )
  90. on rationalize;
  91. 1/(x+sqrt5-cbrt3);
  92. 5 240 5 54 4 4000 3 2340 2 21595 13650
  93. (x - (------*a1 + ------*a1 - ------*a1 - ------*a1 + -------*a1 - -------)
  94. 8243 8243 8243 8243 8243 8243
  95. 4
  96. *x -
  97. 108 5 800 4 1800 3 15433 2 15900 14465 3
  98. (------*a1 - ------*a1 - ------*a1 + -------*a1 + -------*a1 + -------)*x
  99. 8243 8243 8243 8243 8243 8243
  100. 3 2
  101. - (a1 - 15*a1)*x -
  102. 900 5 3919 4 15000 3 8775 2 148986 154225
  103. (------*a1 - ------*a1 - -------*a1 - ------*a1 + --------*a1 - --------)*x
  104. 8243 8243 8243 8243 8243 8243
  105. 1919 5 1050 4 18245 3 12528 2 236725 73080
  106. - (------*a1 + ------*a1 - -------*a1 - -------*a1 + --------*a1 - -------
  107. 8243 8243 8243 8243 8243 8243
  108. 6 4 3 2
  109. ))/(x - 15*x - 6*x + 75*x - 90*x - 116)
  110. off arnum, rationalize;
  111. split_field(x**3+2);
  112. *** Splitting field is generated by:
  113. 6
  114. a3 + 108
  115. 1 4 1
  116. {----*a3 + ---*a3,
  117. 36 2
  118. 1 4
  119. - ----*a3 ,
  120. 18
  121. 1 4 1
  122. ----*a3 - ---*a3}
  123. 36 2
  124. for each j in ws product (x-j);
  125. 3
  126. x + 2
  127. split_field(x**3+4*x**2+x-1);
  128. *** Splitting field is generated by:
  129. 3 2
  130. a4 + 4*a4 + a4 - 1
  131. 2 2
  132. {a4,a4 + 3*a4 - 2, - (a4 + 4*a4 + 2)}
  133. for each j in ws product (x-j);
  134. 3 2
  135. x + 4*x + x - 1
  136. split_field(x**3-3*x+7);
  137. *** Splitting field is generated by:
  138. 6 4 2
  139. a6 - 18*a6 + 81*a6 + 1215
  140. 1 4 5 2 1 2
  141. {-----*a6 - ----*a6 + ---*a6 + ---,
  142. 126 42 2 7
  143. 1 4 5 2 4
  144. - (----*a6 - ----*a6 + ---),
  145. 63 21 7
  146. 1 4 5 2 1 2
  147. -----*a6 - ----*a6 - ---*a6 + ---}
  148. 126 42 2 7
  149. for each j in ws product (x-j);
  150. 3
  151. x - 3*x + 7
  152. split_field(x**3+4*x**2+x-1);
  153. *** Splitting field is generated by:
  154. 3 2
  155. a7 + 4*a7 + a7 - 1
  156. 2 2
  157. {a7,a7 + 3*a7 - 2, - (a7 + 4*a7 + 2)}
  158. for each j in ws product (x-j);
  159. 3 2
  160. x + 4*x + x - 1
  161. split_field(x**3-x**2-x-1);
  162. *** Splitting field is generated by:
  163. 6 5 4 3 2
  164. a9 - 6*a9 + 7*a9 + 12*a9 - 17*a9 - 6*a9 + 53
  165. 3 4 3 3 1 2 5 17
  166. { - (----*a9 - ----*a9 - ----*a9 - ----*a9 + ----),
  167. 76 19 38 38 76
  168. 3 4 6 3 1 2 14 17
  169. ----*a9 - ----*a9 - ----*a9 + ----*a9 + ----,
  170. 38 19 19 19 38
  171. 3 4 3 3 1 2 33 59
  172. - (----*a9 - ----*a9 - ----*a9 + ----*a9 - ----)}
  173. 76 19 38 38 76
  174. for each j in ws product (x-j);
  175. 3 2
  176. x - x - x - 1
  177. % A longer example.
  178. off arnum;
  179. defpoly a**6+3*a**5+6*a**4+a**3-3*a**2+12*a+16;
  180. factorize(x**3-3);
  181. 1 5 1 4 1 3 5 2 1
  182. {x - (----*a + ---*a + ---*a + ----*a - ---*a + 1),
  183. 12 4 2 12 4
  184. 1 5 1 4 1 3 7 2 11 4
  185. x - (----*a + ----*a + ---*a - ----*a + ----*a + ---),
  186. 12 12 6 12 12 3
  187. 1 5 1 4 2 3 1 2 2 7
  188. x + ---*a + ---*a + ---*a - ---*a + ---*a + ---}
  189. 6 3 3 6 3 3
  190. end;
  191. (TIME: arnum 2260 2400)