elem.log 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. Codemist Standard Lisp 3.54 for DEC Alpha: May 23 1994
  2. Dump file created: Mon May 23 10:39:11 1994
  3. REDUCE 3.5, 15-Oct-93 ...
  4. Memory allocation: 6023424 bytes
  5. +++ About to read file ndotest.red
  6. comment
  7. This is a demonstration of the working of elementary functions available
  8. in the Reduce system. It is not intended as an accuracy test. Other
  9. functions become available if certain library packages are loaded.
  10. -------
  11. Integer functions that work in all domain modes, independent of switch
  12. NUMVAL, so long as their arguments evaluate to real numbers.
  13. Functions of one argument:
  14. FIX, SGN, ROUND, CEILING, FLOOR
  15. (The following functions are available only in symbolic mode, so they
  16. are not tested here: ISQRT, ICBRT, ILOG2, IROOTN);
  17. fix a;
  18. fix(a)
  19. % will be evaluated only if a evaluates to a real number.
  20. a := 27/4;
  21. 27
  22. a := ----
  23. 4
  24. fix a;
  25. 6
  26. fix 12.345;
  27. 12
  28. sgn (-15/2);
  29. -1
  30. round 12.5;
  31. 13
  32. ceiling 12.5;
  33. 13
  34. floor 12.5;
  35. 12
  36. % isqrt 12.5;
  37. % icbrt 12.5;
  38. % ilog2 130.7;
  39. % irootn(72,4);
  40. % irootn(72,3/2); % this will not evaluate.
  41. comment Functions which require arguments which evaluate to integers:
  42. Function of one argument: FACTORIAL
  43. Fumction of two arguments: PERM, CHOOSE;
  44. $
  45. factorial 10;
  46. 3628800
  47. perm(5,10);
  48. 30240
  49. % permutations of 5 out of 10.
  50. choose(5,10);
  51. 252
  52. % choose 5 out of 10;
  53. comment
  54. These functions are evaluated in dmodes ROUNDED and COMPLEX-ROUNDED
  55. (ON ROUNDED,COMPLEX) so long as their arguments and values evaluate
  56. to real numbers and NUMVAL (normally ON) is ON.
  57. Variable treated as function of no arguments: E, PI.
  58. Functions of one argument:
  59. EXP, LOG, LN, LOG10, NORM, ARG, SQRT,
  60. RAD2DEG, RAD2DMS, DEG2RAD, DEG2DMS, DMS2DEG, DMS2RAD,
  61. SIN, ASIN, COS, ACOS, TAN, ATAN, COT, ACOT, SEC, ASEC, CSC, ACSC,
  62. SINH, ASINH, COSH, ACOSH, TANH, ATANH, COTH, ACOTH, SECH, ASECH,
  63. CSCH, ACSCH.
  64. Functions of two arguments:
  65. EXPT, LOGB, HYPOT, ATAN2.
  66. Function evaluation is carried out to the precision specified in the
  67. latest PRECISION statement.
  68. (The following functions are available only in symbolic mode, so they
  69. are not tested here:
  70. SIND, ASIND, COSD, ACOSD, TAND, ATAND, COTD, ACOTD, SECD, ASECD,
  71. CSCD, ACSCD, ATAN2D, CBRT);
  72. on rounded;
  73. precision 6;
  74. 12
  75. a := exp 3;
  76. a := 20.0855
  77. log a;
  78. 3.0
  79. ln a;
  80. 3.0
  81. log10 1000;
  82. 3.0
  83. norm (-12.345);
  84. 12.345
  85. % for real x, this is equivalent to ABS x.
  86. arg (-12.345);
  87. 3.14159
  88. % for real x, this -> if x<0 then pi else 0.0.
  89. sqrt 3;
  90. 1.73205
  91. ws**2;
  92. 3.0
  93. deg2rad 30;
  94. 0.523599
  95. rad2deg ws;
  96. 30.0
  97. a := deg2dms 12.345;
  98. a := {12,20,42.0}
  99. % a will be a list.
  100. dms2deg ws;
  101. 12.345
  102. dms2rad a;
  103. 0.215461
  104. rad2deg ws;
  105. 12.345
  106. asin 0.5;
  107. 0.523599
  108. sin ws;
  109. 0.5
  110. acos 0.5;
  111. 1.0472
  112. cos ws;
  113. 0.5
  114. atan 0.5;
  115. 0.463648
  116. tan ws;
  117. 0.5
  118. acot 0.5;
  119. 1.10715
  120. cot ws;
  121. 0.5
  122. asec 3;
  123. 1.23096
  124. sec ws;
  125. 3.0
  126. acsc 3;
  127. 0.339837
  128. csc ws;
  129. 3.0
  130. asinh 0.5;
  131. 0.481212
  132. sinh ws;
  133. 0.5
  134. acosh 2;
  135. 1.31696
  136. cosh ws;
  137. 2.0
  138. atanh 0.5;
  139. 0.549306
  140. tanh ws;
  141. 0.5
  142. acoth 2;
  143. 0.549306
  144. coth ws;
  145. 2.0
  146. sech 1;
  147. 0.648054
  148. asech ws;
  149. 1
  150. csch 1;
  151. 0.850918
  152. acsch ws;
  153. 1
  154. expt(2,1.234);
  155. 2.35218
  156. logb(ws,2);
  157. 1.234
  158. hypot(3,4);
  159. 5.0
  160. a := -3*pi/4;
  161. a := - 2.35619
  162. % any -pi<a<=pi should work.
  163. atan2(sin a,cos a);
  164. - 2.35619
  165. ws - a;
  166. 0
  167. % should be 0.
  168. precision 20;
  169. 6
  170. % functions will be computed to 20 places.
  171. sin 1.5;
  172. 0.99749498660405443094
  173. asin ws;
  174. 1.5
  175. precision 50;
  176. 20
  177. % fuctions computed to 50 places.
  178. sin 1.5;
  179. 0.99749498660405443094172337114148732270665142592212
  180. asin ws;
  181. 1.5
  182. precision 6;
  183. 50
  184. comment If argument or value are complex, functions are not computed
  185. when dmode is ROUNDED;
  186. $
  187. sin(1+i);
  188. sin(i + 1)
  189. % complex argument.
  190. asin 2;
  191. asin(2)
  192. % value would be complex.
  193. on complex;
  194. *** Domain mode rounded changed to complex-rounded
  195. %now complex arguments and complex results will be handled.
  196. comment Complex functions of one argument:
  197. EXP, LOG, NORM, ARG, SQRT,
  198. SIN, ASIN, COS, ACOS, TAN, ATAN, COT, ACOT, SEC, ASEC, CSC, ACSC,
  199. SINH, ASINH, COSH. ACOSH, TANH, ATANH, COTH, ACOTH, SECH, ASECH,
  200. CSCH, ACSCH.
  201. (The following functions are available only in symbolic mode, so they
  202. are not tested here:
  203. SIND, ASIND, COSD, ACOSD, TAND, ATAND, COTD, ACOTD, SECD, ASECD,
  204. CSCD, ACSCD.)
  205. Complex function of two variables: EXPT, LOGB, ATAN2;
  206. e**(pi*i);
  207. -1 + 1.22465e-16*i
  208. % should be -1 (except for computational error.)
  209. log(1+i);
  210. 0.346574 + 0.785398*i
  211. exp ws;
  212. 1 + i
  213. norm(5*exp(2i));
  214. 5.0
  215. arg(5*exp(2i));
  216. 2.0
  217. sqrt(1+i);
  218. 1.09868 + 0.45509*i
  219. ws**2;
  220. 1 + i
  221. asin 2;
  222. 1.5708 - 1.31696*i
  223. sin ws;
  224. 2.0 - 1.06058e-16*i
  225. acos 2;
  226. 1.31696*i
  227. cos ws;
  228. 2.0
  229. atan(1+i);
  230. 1.01722 + 0.402359*i
  231. tan ws;
  232. 1 + i
  233. acot(1+i);
  234. 0.553574 - 0.402359*i
  235. cot ws;
  236. 1 + i
  237. asec 0.1;
  238. 2.99322*i
  239. sec ws;
  240. 0.1
  241. acsc 0.1;
  242. 1.5708 - 2.99322*i
  243. csc ws;
  244. 0.1 + 6.09254e-18*i
  245. sinh(1+i);
  246. 0.634964 + 1.29846*i
  247. asinh ws;
  248. 1 + i
  249. cosh(1+i);
  250. 0.83373 + 0.988898*i
  251. acosh ws;
  252. 1 + i
  253. atanh 2;
  254. 0.549306 + 1.5708*i
  255. tanh ws;
  256. 2.0 + 1.83697e-16*i
  257. acoth 0.3;
  258. 0.30952 + 1.5708*i
  259. coth ws;
  260. 0.3 - 5.57214e-17*i
  261. asech(1-i);
  262. 0.530638 + 1.11852*i
  263. sech ws;
  264. 1 - i
  265. acsch(1-i);
  266. 0.530638 + 0.452278*i
  267. csch ws;
  268. 1 - i
  269. expt(1+i,1-i);
  270. 2.80788 + 1.31787*i
  271. logb(ws,1+i);
  272. 1 - i
  273. a := 1+i;
  274. a := 1 + i
  275. % any a such that - pi < repart a <= pi should work.
  276. atan2(sin a,cos a);
  277. 1 + i
  278. ws - a;
  279. 0
  280. % should be 0;
  281. end;
  282. (TIME: elem 1200 1200)
  283. End of Lisp run after 1.21+0.64 seconds