Thu Feb 25 19:02:11 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; # ---------- The Complex Domain ---------- # Complex functions---separate into their real and imaginary parts. # Here, variables default to COMPLEX. # [Re(x + i y), Im(x + i y)] => [Re(x) - Im(y), Im(x) + Re(y)] # for x and y complex O1 := [Re(x + I*y), Im(x + I*y)]; [Re(x + I y), Im(x + I y)] time = 0.16, bytes = 325450 O2 := assume(x, real, y, real): time = 0.01, bytes = 8502 O3 := [Re(x + I*y), Im(x + I*y)]; [x~, y~] time = 0.01, bytes = 11806 O4 := x:= 'x': time = 0.01, bytes = 4534 O5 := y:= 'y': time = 0.00, bytes = 4750 # => 1 [W. Kahan] O6 := abs(3 - sqrt(7) + I*sqrt(6*sqrt(7) - 15)); 1/2 2 1/2 1/2 ((3 - 7 ) + 6 7 - 15) time = 0.21, bytes = 242786 O7 := simplify(%); 1 time = 0.08, bytes = 107262 # => 1/sqrt(a^2 + (1/a + b)^2) for real a, b O8 := assume(a, real, b, real): time = 0.00, bytes = 12178 O9 := abs(1/(a + I/a + I*b)); bytes used=1002216, alloc=851812, time=0.71 1 ----------------------- / 2 / 1 \2\1/2 |a~ + |---- + b~| | \ \ a~ / / time = 0.98, bytes = 633582 O10 := a:= 'a': time = 0.01, bytes = 4158 O11 := b:= 'b': time = 0.01, bytes = 4446 # => log 5 + i arctan(4/3) O12 := evalc(log(3 + 4*I)); ln(5) + I arctan(4/3) time = 0.05, bytes = 53038 # => [sin(x) cos(x) + i sinh(y) cosh(y)] / [cos(x)^2 + sinh(y)^2] O13 := evalc(tan(x + I*y)); sin(x) cos(x) I sinh(y) cosh(y) ------------------ + ------------------ 2 2 2 2 cos(x) + sinh(y) cos(x) + sinh(y) time = 0.05, bytes = 46094 # Check for branch abuse. See David R. Stoutemyer, ``Crimes and Misdemeanors # in the Computer Algebra Trade'', _Notices of the American Mathematical # Society_, Volume 38, Number 7, September 1991, 778--785. This first # expression can simplify to sqrt(x y)/sqrt(x), but no further in general # (consider what happens when x, y = -1). sqrt(x y) = sqrt(x) sqrt(y) if # either x >= 0 or y >= 0 or both x and y lie in the right-half plane # (Re x, Re y > 0) [considering principal values]. O14 := expr:= sqrt(x*y*abs(z)^2) / (sqrt(x)*abs(z)); 1/2 (x y) -------- 1/2 x time = 0.06, bytes = 48058 O15 := simplify(%); 1/2 (x y) -------- 1/2 x time = 0.09, bytes = 82934 O16 := assume(x, real, y, real, z, real): time = 0.01, bytes = 8766 O17 := simplify(expr); 1/2 (x~ y~) ---------- 1/2 x~ time = 0.16, bytes = 128982 O18 := x:= 'x': time = 0.00, bytes = 4182 O19 := y:= 'y': time = 0.01, bytes = 3678 O20 := z:= 'z': time = 0.00, bytes = 4086 # Special case: sqrt(x y |z|^2)/(sqrt(x) |z|) => sqrt(y) [PV] for y >= 0 O21 := assume(y >= 0): time = 0.01, bytes = 11046 O22 := simplify(expr); bytes used=2002576, alloc=1441528, time=2.15 1/2 (x y~) --------- 1/2 x time = 0.24, bytes = 83034 O23 := y:= 'y': time = 0.01, bytes = 3542 O24 := assume(x > 0): time = 0.01, bytes = 6142 O25 := simplify(expr); 1/2 y time = 0.05, bytes = 43730 O26 := x:= 'x': time = 0.01, bytes = 3418 # sqrt(1/z) = 1/sqrt(z) except when z is real and negative, in which case # sqrt(1/z) = - 1/sqrt(z) [considering principal values] O27 := expr:= sqrt(1/z) - 1/sqrt(z); 1/2 1 (1/z) - ---- 1/2 z time = 0.02, bytes = 12466 O28 := simplify(%); 1/2 1/2 (1/z) z - 1 ----------------- 1/2 z time = 0.05, bytes = 45158 O29 := assume(z, real): time = 0.00, bytes = 5246 O30 := simplify(expr); / 1 \1/2 1/2 |----| z~ - 1 \ z~ / ------------------- 1/2 z~ time = 0.12, bytes = 83474 O31 := z:= 'z': time = 0.00, bytes = 3738 # Special case: sqrt(1/z) - 1/sqrt(z) => 0 [PV] for z > 0 O32 := assume(z > 0): time = 0.01, bytes = 9562 O33 := simplify(expr); 0 time = 0.03, bytes = 21250 O34 := z:= 'z': time = 0.01, bytes = 3422 # Special case: sqrt(1/z) + 1/sqrt(z) => 0 [PV] for z < 0 O35 := assume(z < 0): time = 0.01, bytes = 9218 O36 := sqrt(1/z) + 1/sqrt(z); / 1 \1/2 I I |- ----| - -------- \ z~ / 1/2 (-z~) time = 0.03, bytes = 22178 O37 := simplify(%); 0 time = 0.06, bytes = 53510 O38 := z:= 'z': time = 0.01, bytes = 3530 # sqrt(e^z) = e^(z/2) if and only if Im z is contained in the interval # ((4 n - 1) pi, (4 n + 1) pi] for n an integer: ..., (-5 pi, -3 pi], # (-pi, pi], (3 pi, 5 pi], ...; otherwise, sqrt(e^z) = - e^(z/2) [considering # principal values] O39 := expr:= [sqrt(exp(1)^z) - exp(1)^(z/2), sqrt(exp(z)) - exp(z/2)]; z 1/2 (1/2 z) 1/2 [(exp(1) ) - exp(1) , exp(z) - exp(1/2 z)] time = 0.04, bytes = 35350 O40 := simplify(%); 1/2 1/2 [exp(z) - exp(1/2 z), exp(z) - exp(1/2 z)] time = 0.27, bytes = 225338 # Special case: sqrt(e^z) - e^(z/2) => 0 [PV] for z real O41 := assume(z, real): time = 0.01, bytes = 8502 O42 := simplify(expr); [0, 0] time = 0.15, bytes = 122490 O43 := z:= 'z': time = 0.01, bytes = 3434 # The principal value of this expression is - e^(3 i) = - cos 3 - i sin 3 O44 := expr:= [sqrt(exp(1)^(6*I)), sqrt(exp(6*I))]; (6 I) 1/2 1/2 [(exp(1) ) , exp(6 I) ] time = 0.11, bytes = 93938 O45 := simplify(%); bytes used=3002852, alloc=1507052, time=3.55 [-exp(3 I), -exp(3 I)] time = 0.49, bytes = 225378 O46 := simplify(evalc(expr)); bytes used=4002988, alloc=1703624, time=4.82 1/2 1/2 [1/2 (2 + 2 cos(6)) - 1/2 I (2 - 2 cos(6)) , 1/2 1/2 1/2 (2 + 2 cos(6)) - 1/2 I (2 - 2 cos(6)) ] time = 1.07, bytes = 848974 O47 := evalf(%); [.9899924965 - .1411200084 I, .9899924965 - .1411200084 I] time = 0.01, bytes = 8142 # log(e^z) = z if and only if Im z is contained in the interval (-pi, pi] # [considering principal values] O48 := expr:= [log(exp(1)^z), log(exp(z))]; z [ln(exp(1) ), ln(exp(z))] time = 0.03, bytes = 12018 O49 := simplify(%); [ln(exp(z)), ln(exp(z))] time = 0.02, bytes = 18646 # Special case: log(e^z) => z [PV] for z real O50 := assume(z, real): time = 0.01, bytes = 7954 O51 := simplify(expr); [z~, z~] time = 0.03, bytes = 22390 O52 := z:= 'z': time = 0.01, bytes = 3362 # The principal value of this expression is (10 - 4 pi) i O53 := expr:= [log(exp(1)^(10*I)), log(exp(10*I))]; (10 I) [ln(exp(1) ), ln(exp(10 I))] time = 0.01, bytes = 10942 O54 := simplify(%); [ln(exp(10 I)), ln(exp(10 I))] time = 0.12, bytes = 114070 O55 := expand(simplify(evalc(expr))); [10 I - 4 I Pi, 10 I - 4 I Pi] time = 0.29, bytes = 270074 # (x y)^n = x^n y^n if either x > 0 or y > 0 or both x and y lie in the # right-half plane (Re x, Re y > 0) or n is an integer [considering principal # values] O56 := expr:= (x*y)^(1/n) - x^(1/n)*y^(1/n); (1/n) (1/n) (1/n) (x y) - x y time = 0.02, bytes = 13782 O57 := simplify(%); (1/n) (1/n) (1/n) (x y) - x y time = 0.04, bytes = 40114 O58 := assume(x, real, y, real): time = 0.01, bytes = 6682 O59 := simplify(expr); (1/n) (1/n) (1/n) (x~ y~) - x~ y~ time = 0.14, bytes = 109558 O60 := x:= 'x': time = 0.01, bytes = 3498 O61 := y:= 'y': time = 0.01, bytes = 3498 # Special case: (x y)^(1/n) - x^(1/n) y^(1/n) => 0 [PV] for y > 0 O62 := assume(y > 0): time = 0.01, bytes = 9414 O63 := simplify(expr); 0 time = 0.04, bytes = 31702 O64 := y:= 'y': time = 0.00, bytes = 3230 # Special case: (x y)^n - x^n y^n => 0 [PV] for integer n O65 := assume(n, integer): time = 0.01, bytes = 8506 O66 := (x*y)^n - x^n*y^n; n~ n~ n~ (x y) - x y time = 0.01, bytes = 4058 O67 := simplify(%); 0 time = 0.05, bytes = 39702 O68 := n:= 'n': time = 0.00, bytes = 3418 # arctan(tan(z)) = z for z real if and only if z is contained in the interval # (-pi/2, pi/2] [considering principal values] O69 := expr:= arctan(tan(z)); arctan(tan(z)) time = 0.02, bytes = 11286 O70 := simplify(%); arctan(tan(z)) time = 0.05, bytes = 35558 O71 := assume(z, real): time = 0.00, bytes = 4994 O72 := simplify(expr); arctan(tan(z~)) time = 0.02, bytes = 20958 O73 := z:= 'z': time = 0.00, bytes = 3366 # Special case: arctan(tan(z)) => z [PV] for -pi/2 < z < pi/2 O74 := assume(-Pi < z, z < Pi/2): time = 0.03, bytes = 25682 O75 := simplify(expr); arctan(tan(z~)) time = 0.04, bytes = 32850 O76 := z:= 'z': time = 0.00, bytes = 3298 O77 := expr:= 'expr': time = 0.01, bytes = 3494 # The principal value of this expression is 10 - 3 pi O78 := arctan(tan(10)); bytes used=5003308, alloc=1703624, time=6.18 10 - 3 Pi time = 0.22, bytes = 24742 # The principal value of this expression is 11 - 4 pi + 30 i = -1.56637 + 30 i O79 := arctan(tan(11 + 30*I)); 11 + 30 I - 4 Pi time = 0.03, bytes = 26026 O80 := arctan(tan(11.0 + 30.0*I)); -.7853981634 + 32.36359494 I time = 0.04, bytes = 43074 # This is a challenge problem proposed by W. Kahan: simplify the following # expression for complex z. Expanding out the expression produces # (z^2 + 1)/(2 z) +- (z + 1)*(z - 1)/(2 z) => z or 1/z in each of its branches O81 := w:= (z + 1/z)/2; 1/2 z + 1/2 1/z time = 0.02, bytes = 13574 O82 := expr:= w + sqrt(w + 1)*sqrt(w - 1); 1/2 1/2 1/2 z + 1/2 1/z + 1/4 (2 z + 2/z + 4) (2 z + 2/z - 4) time = 0.06, bytes = 39782 O83 := radsimp(expr); z time = 0.11, bytes = 104186 O84 := w:= 'w': time = 0.00, bytes = 3374 O85 := expr:= 'expr': time = 0.01, bytes = 3330 # ---------- Quit ---------- O86 := quit bytes used=5278888, alloc=1703624, time=6.49 real 7.80 user 6.64 sys 0.87