Thu Feb 25 19:31:22 MST 1999 aquarius% maple |\^/| Maple V Release 5.1 (WMI Campus Wide License) ._|\| |/|_. Copyright (c) 1981-1998 by Waterloo Maple Inc. All rights \ MAPLE / reserved. Maple and Maple V are registered trademarks of <____ ____> Waterloo Maple Inc. | Type ? for help. # ----------[ M a p l e ]---------- #interface(echo = 3); # ---------- Initialization ---------- > readlib(showtime): > _Envadditionally:= true: > on; # ---------- Trigonometry ---------- # => - [(sqrt(5) + 1) sqrt(2)]/[(sqrt(5) - 1) sqrt(sqrt(5) + 5)] # = - sqrt[1 + 2/sqrt(5)] # From B. F. Caviness, Robert P. Gilbert, Wolfram Koepf, Roman Shtokhamer and # David W. Wood, _An Introduction to Applied Symbolic Computation using # MACSYMA_, University of Delaware, draft of December 14, 1993, section 2.3.3. O1 := tan(7*Pi/10); 1/2 1/2 1/2 - 1/5 5 (5 + 2 5 ) time = 0.05, bytes = 64618 # => - cos 3 O2 := sqrt((1 + cos(6))/2); 1/2 1/2 (2 + 2 cos(6)) time = 0.14, bytes = 216666 # cos(n pi) + sin((4 n - 1)/2 pi) => (-1)^n - 1 for integer n O3 := assume(n, integer): time = 0.09, bytes = 235290 O4 := cos(n*Pi) + sin((4*n - 1)/2 * Pi); n~ (-1) - 1 time = 0.14, bytes = 144578 # cos(cos(n pi) pi) + sin(cos(n pi) pi/2) => -1 + (-1)^n for integer n O5 := cos(cos(n*Pi)*Pi) + sin(cos(n*Pi)*Pi/2); bytes used=1000380, alloc=851812, time=0.74 n~ (1/2 (-1) - 1/2) -1 + (-1) time = 0.31, bytes = 197878 # sin([n^5/5 + n^4/2 + n^3/3 - n/30] pi) => 0 for integer n # [Paul Zimmermann] O6 := sin((n^5/5 + n^4/2 + n^3/3 - n/30) * Pi); 0 time = 0.10, bytes = 112778 O7 := n:= 'n': time = 0.00, bytes = 4110 # | cos x |, | sin x | => - cos x, - sin x for - 3 pi < x < - 5/2 pi O8 := assume(-3*Pi < x, x < -5/2*Pi): time = 0.04, bytes = 32054 O9 := [abs(cos(x)), abs(sin(x))]; [-cos(x~), -sin(x~)] time = 0.11, bytes = 108058 O10 := x:= 'x': time = 0.01, bytes = 4646 # Trigonometric manipulations---these are typically difficult for students O11 := r:= cos(3*x)/cos(x); cos(3 x) -------- cos(x) time = 0.01, bytes = 9522 # => cos(x)^2 - 3 sin(x)^2 or similar O12 := expand(r); 2 4 cos(x) - 3 time = 0.00, bytes = 11162 # => 2 cos(2 x) - 1 O13 := combine(expand(r)); 2 cos(2 x) - 1 time = 0.10, bytes = 142494 # Use rewrite rules => cos(x)^2 - 3 sin(x)^2 O14 := cos_Angles:= proc(e) O14 := local s; O14 := if match(e = cos(n*x), x, 's') and rhs(s[1]) > 1 then O14 := subs(s, cos((n - 1)*x) * cos(x) - sin((n - 1)*x) * sin(x)) O14 := else O14 := e O14 := fi O14 := end: time = 0.05, bytes = 39902 O15 := sin_Angles:= proc(e) O15 := local s; O15 := if match(e = sin(n*x), x, 's') and rhs(s[1]) > 1 then O15 := subs(s, sin((n - 1)*x) * cos(x) + cos((n - 1)*x) * sin(x)) O15 := else O15 := e O15 := fi O15 := end: time = 0.05, bytes = 33154 O16 := sincos_Angles:= proc(e) O16 := if op(e) = e then O16 := e O16 := else O16 := map(sincos_Angles, sin_Angles(cos_Angles(e))) O16 := fi O16 := end: time = 0.04, bytes = 26938 O17 := sincos_Angles(r); 2 2 2 (cos(x) - sin(x) ) cos(x) - 2 sin(x) cos(x) --------------------------------------------- cos(x) time = 0.18, bytes = 218590 O18 := expand(%); 2 2 cos(x) - 3 sin(x) time = 0.01, bytes = 6066 O19 := r:= 'r': time = 0.00, bytes = 4458 # Here is a tricky way of writing 0/0 O20 := expr:= (tan(x)^2 + 1 - sec(x)^2)/(sin(x)^2 + cos(x)^2 - 1); 2 2 tan(x) + 1 - sec(x) --------------------- 2 2 sin(x) + cos(x) - 1 time = 0.02, bytes = 14070 # Let's try simplifying this expression! O21 := simplify(expr); 1 ------- 2 cos(x) time = 0.10, bytes = 134570 bytes used=2000608, alloc=1376004, time=1.79 # What is its limit at zero? O22 := limit(expr, x = 0); 2 2 tan(x) + 1 - sec(x) lim --------------------- x -> 0 2 2 sin(x) + cos(x) - 1 time = 0.61, bytes = 485626 # What is the derivative? O23 := simplify(diff(expr, x)); sin(x) 2 ------- 3 cos(x) time = 0.05, bytes = 51790 O24 := expr:= 'expr': time = 0.00, bytes = 3846 # ---------- Quit ---------- O25 := quit bytes used=2561120, alloc=1376004, time=2.34 real 3.23 user 2.41 sys 0.80