1 /* Original version of this file copyright 1999 by Michael Wester,
2 * and retrieved from http://www.math.unm.edu/~wester/demos/Numbers/problems.macsyma
5 * Released under the terms of the GNU General Public License, version 2,
6 * per message dated 2007-06-03 from Michael Wester to Robert Dodier
7 * (contained in the file wester-gpl-permission-message.txt).
9 * See: "A Critique of the Mathematical Abilities of CA Systems"
10 * by Michael Wester, pp 25--60 in
11 * "Computer Algebra Systems: A Practical Guide", edited by Michael J. Wester
12 * and published by John Wiley and Sons, Chichester, United Kingdom, 1999.
14 /* ----------[ M a c s y m a ]---------- */
15 /* ---------- Initialization ---------- */
18 /* ---------- Numbers ---------- */
19 /* Let's begin by playing with numbers: infinite precision integers
20 => 30414 0932017133 7804361260 8166064768 8443776415 6896051200 0000000000
23 /* => 2^47 3^22 5^12 7^8 11^4 13^3 17^2 19^2 23^2 29 31 37 41 43 47 */
25 /* Double factorial => 10!! = 10*8*6*4*2 = 3840, 9!! = 9*7*5*3*1 = 945 */
27 /* ABC base 16 => 2748 base 10 */
31 /* 123 base 10 => 234 base 7 */
35 /* 677 base 8 => 1BF base 16 */
41 /* [log base 8](32768) => 5 */
43 /* 5^(-1) mod 7 => 3; 5^(-1) mod 6 => 5 */
49 /* Greatest common divisor => 74 */
50 gcdn([1776, 1554, 5698]);
51 /* Infinite precision rational numbers => 4861/2520 */
52 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + 1/8 + 1/9 + 1/10;
53 /* Complete decimal expansion of a rational number => 0.142857 ... */
55 /* Multiply two complete decimal expansions and produce an exact result => 2 */
57 /* This number should immediately simplify to 3^(1/3) */
58 10/7 * (1 + 29/1000)^(1/3);
59 /* Simplify an expression with nested square roots => 1 + sqrt(3) */
62 /* Try a more complicated example (from the Putnam exam) => 3 + sqrt(2) */
63 sqrt(14 + 3*sqrt(3 + 2*sqrt(5 - 12*sqrt(3 - 2*sqrt(2)))));
65 /* See D.J. Jeffrey and A.D. Rich, ``The nesting habits of radicals'', draft of
66 1998 => sqrt(2) + sqrt(3) + sqrt(5) */
67 sqrt(10 + 2*sqrt(6) + 2*sqrt(10) + 2*sqrt(15));
69 /* Rationalize the denominator => 5 + 2 sqrt(6) */
70 (sqrt(3) + sqrt(2))/(sqrt(3) - sqrt(2));
71 ratsimp(%), algebraic: true;
73 /* A factorization of 3 in the integers extended by sqrt(-5) */
74 sqrt(-2 + sqrt(-5)) * sqrt(-2 - sqrt(-5));
75 ratsimp(rootscontract(%));
76 /* => 3 + sqrt(7) [Jeffrey and Rich] */
77 (90 + 34*sqrt(7))^(1/3);
79 /* This is a nontrivial way of writing 12 ! */
80 ((135 + 78*sqrt(3))^(2/3) + 3)*sqrt(3)/(135 + 78*sqrt(3))^(1/3);
81 ratsimp(%), algebraic: true;
83 /* See David Jeffrey, ``Current Problems in Computer Algebra Systems'', talk
85 (49 + 21*sqrt(2))^(1/5);
87 /* A nasty example generated by Axiom => [log(sqrt(2) + 1) + sqrt(2)]/3 */
88 ((6 - 4*sqrt(2))*log(3 - 2*sqrt(2)) + (3 - 2*sqrt(2))*log(17 - 12*sqrt(2))
89 + 32 - 24*sqrt(2)) / (48*sqrt(2) - 72);
90 ratsimp(logcontract(ev(ratsimp(%), algebraic: true)));
92 dfloat((log(sqrt(2) + 1) + sqrt(2))/3);
93 /* Cardinal numbers => infinity */
96 /* 2^aleph_0 => aleph_1 */