Mon Feb 16 11:17:13 MST 1998 aquarius% mupad *----* MuPAD 1.4.0 -- Multi Processing Algebra Data Tool /| /| *----* | Copyright (c) 1997 - 98 by SciFace Software GmbH | *--|-* All rights reserved. |/ |/ *----* Licensed to: Michael Wester >> # ----------[ M u P A D ]---------- # >> # ---------- Initialization ---------- # >> TEXTWIDTH:= 80: >> read("../../Time.mupad"): >> # ---------- 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 # >> [Re(x + I*y), Im(x + I*y)]; [Re(x) - Im(y), Im(x) + Re(y)] Time: 7540 msec Type: DOM_LIST >> assume(x, Type::RealNum): >> assume(y, Type::RealNum): >> [Re(x + I*y), Im(x + I*y)]; [x, y] Time: 1420 msec Type: DOM_LIST >> unassume(x, Type::RealNum): >> unassume(y, Type::RealNum): >> # => 1 [W. Kahan] # >> abs(3 - sqrt(7) + I*sqrt(6*sqrt(7) - 15)); 1 Time: 860 msec Type: DOM_INT >> # => 1/sqrt(a^2 + (1/a + b)^2) for real a, b # >> assume(a, Type::RealNum): >> assume(b, Type::RealNum): >> abs(1/(a + I/a + I*b)); 1 ------------------------- / 1 2 2 2 b \1/2 | -- + a + b + --- | | 2 a | \ a / Time: 670 msec Type: "_power" >> unassume(a, Type::RealNum): >> unassume(b, Type::RealNum): >> # => log 5 + i arctan(4/3) # >> rectform(ln(3 + 4*I)); ln(5) + atan(4/3) I Time: 990 msec Type: rectform >> # => [sin(x) cos(x) + i sinh(y) cosh(y)] / [cos(x)^2 + sinh(y)^2] # >> rectform(tan(x + I*y), {x, y}); sin(2 x) / sinh(2 y) \ -------------------- + | -------------------- | I cos(2 x) + cosh(2 y) \ cos(2 x) + cosh(2 y) / Time: 780 msec Type: rectform >> # 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]. # >> sqrt(x*y*abs(z)^2) / (sqrt(x)*abs(z)); 1/2 (x y) -------- 1/2 x Time: 190 msec Type: "_mult" >> simplify(%); 1 --------------- 1/2 / 1 \1/2 x | --- | \ x y / Time: 13050 msec Type: "_mult" >> assume(x, Type::RealNum): >> assume(y, Type::RealNum): >> assume(z, Type::RealNum): >> sqrt(x*y*abs(z)^2) / (sqrt(x)*abs(z)); 1/2 (x y) -------- 1/2 x Time: 820 msec Type: "_mult" >> simplify(%); 1 --------------- 1/2 / 1 \1/2 x | --- | \ x y / Time: 15700 msec Type: "_mult" >> unassume(x, Type::RealNum): >> unassume(y, Type::RealNum): >> unassume(z, Type::RealNum): >> # Special case: sqrt(x y |z|^2)/(sqrt(x) |z|) => sqrt(y) [PV] for y >= 0 # >> assume(y >= 0): >> sqrt(x*y*abs(z)^2) / (sqrt(x)*abs(z)); 1/2 (x y) -------- 1/2 x Time: 1160 msec Type: "_mult" >> simplify(%); 1/2 y Time: 590 msec Type: "_power" >> unassume(y >= 0): >> # 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] # >> sqrt(1/z) - 1/sqrt(z); / 1 \1/2 1 | - | - ---- \ z / 1/2 z Time: 460 msec Type: "_plus" >> simplify(%); / 1 \1/2 1 | - | - ---- \ z / 1/2 z Time: 940 msec Type: "_plus" >> assume(z, Type::RealNum): >> sqrt(1/z) - 1/sqrt(z); / 1 \1/2 1 | - | - ---- \ z / 1/2 z Time: 450 msec Type: "_plus" >> simplify(%); 1 1 --------------- - ---- 1/2 1/2 1/2 z sign(z) z Time: 6010 msec Type: "_plus" >> unassume(z, Type::RealNum): >> # Special case: sqrt(1/z) - 1/sqrt(z) => 0 [PV] for z > 0 # >> assume(z > 0): >> sqrt(1/z) - 1/sqrt(z); / 1 \1/2 1 | - | - ---- \ z / 1/2 z Time: 720 msec Type: "_plus" >> simplify(%); 0 Time: 350 msec Type: DOM_INT >> unassume(z > 0): >> # Special case: sqrt(1/z) + 1/sqrt(z) => 0 [PV] for z < 0 # >> assume(z < 0): >> sqrt(1/z) + 1/sqrt(z); 1 / 1 \1/2 ---- + | - | 1/2 \ z / z Time: 730 msec Type: "_plus" >> simplify(%); 1 / 1 \1/2 ---- + | - | 1/2 \ z / z Time: 2290 msec Type: "_plus" >> unassume(z < 0): >> # 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] # >> [sqrt(E^z) - E^(z/2), sqrt(exp(z)) - exp(z/2)]; -- z -- | - | | 1/2 2 1/2 / z \ | | exp(z) - exp(1) , exp(z) - exp| - | | -- \ 2 / -- Time: 650 msec Type: DOM_LIST >> simplify(%); [0, 0] Time: 910 msec Type: DOM_LIST >> # Special case: sqrt(e^z) - e^(z/2) => 0 [PV] for z real # >> assume(z, Type::RealNum): >> [sqrt(E^z) - E^(z/2), sqrt(exp(z)) - exp(z/2)]; -- z -- | - | | / z \ 2 | | exp| - | - exp(1) , 0 | -- \ 2 / -- Time: 670 msec Type: DOM_LIST >> simplify(%); [0, 0] Time: 550 msec Type: DOM_LIST >> unassume(z, Type::RealNum): >> # The principal value of this expression is - e^(3 i) = - cos 3 - i sin 3 # >> [sqrt(E^(6*I)), sqrt(exp(6*I))]; [-exp(3 I), -exp(3 I)] Time: 530 msec Type: DOM_LIST >> # log(e^z) = z if and only if Im z is contained in the interval (-pi, pi] &> [considering principal values] # >> [ln(E^z), ln(exp(z))]; z [ln(exp(1) ), ln(exp(z))] Time: 230 msec Type: DOM_LIST >> simplify(%); [z, ln(exp(z))] Time: 540 msec Type: DOM_LIST >> # Special case: log(e^z) => z [PV] for z real # >> assume(z, Type::RealNum): >> [ln(E^z), ln(exp(z))]; z [ln(exp(1) ), ln(exp(z))] Time: 490 msec Type: DOM_LIST >> simplify(%); [z, z] Time: 270 msec Type: DOM_LIST >> unassume(z, Type::RealNum): >> # The principal value of this expression is (10 - 4 pi) i # >> [ln(E^(10*I)), ln(exp(10*I))]; 10 I [ln(exp(1) ), 10 I - 4 I PI] Time: 490 msec Type: DOM_LIST >> simplify(%); [10 I, 10 I - 4 I PI] Time: 370 msec Type: DOM_LIST >> # (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] # >> (x*y)^(1/n) - x^(1/n)*y^(1/n); 1 1 1 - - - n n n (x y) - x y Time: 250 msec Type: "_plus" >> simplify(%); 1 1 1 - - - n n n (x y) - x y Time: 2690 msec Type: "_plus" >> assume(x, Type::RealNum): >> assume(y, Type::RealNum): >> (x*y)^(1/n) - x^(1/n)*y^(1/n); 1 1 1 - - - n n n (x y) - x y Time: 730 msec Type: "_plus" >> simplify(%); 1 1 1 - - - n n n (x y) - x y Time: 6830 msec Type: "_plus" >> unassume(x, Type::RealNum): >> unassume(y, Type::RealNum): >> # Special case: (x y)^(1/n) - x^(1/n) y^(1/n) => 0 [PV] for y > 0 # >> assume(y > 0): >> (x*y)^(1/n) - x^(1/n)*y^(1/n); 1 1 1 - - - n n n (x y) - x y Time: 990 msec Type: "_plus" >> simplify(%); 1 1 1 - - - n n n x y - (x y) Time: 940 msec Type: "_plus" >> unassume(y > 0): >> # Special case: (x y)^n - x^n y^n => 0 [PV] for integer n # >> assume(n, Type::Integer): >> (x*y)^n - x^n*y^n; n n n (x y) - x y Time: 770 msec Type: "_plus" >> simplify(%); n n n (x y) - x y Time: 2630 msec Type: "_plus" >> unassume(n, Type::Integer): >> # arctan(tan(z)) = z for z real if and only if z is contained in the interval &> (-pi/2, pi/2] [considering principal values] # >> atan(tan(z)); atan(tan(z)) Time: 1440 msec Type: "atan" >> simplify(%); atan(tan(z)) Time: 250 msec Type: "atan" >> assume(z, Type::RealNum): >> atan(tan(z)); atan(tan(z)) Time: 3260 msec Type: "atan" >> simplify(%); atan(tan(z)) Time: 330 msec Type: "atan" >> unassume(z, Type::RealNum): >> # Special case: arctan(tan(z)) => z [PV] for -pi/2 < z < pi/2 # >> assume(-Pi/2 < z): >> assume(z < Pi/2): >> atan(tan(z)); atan(tan(z)) Time: 2920 msec Type: "atan" >> simplify(%); atan(tan(z)) Time: 260 msec Type: "atan" >> unassume(z): >> # The principal value of this expression is 10 - 3 pi # >> atan(tan(10)); 10 - 3 PI Time: 520 msec Type: "_plus" >> # The principal value of this expression is 11 - 4 pi + 30 i = -1.56637 + 30 i # >> atan(tan(11 + 30*I)); (11 + 30 I) - 4 PI Time: 1470 msec Type: "_plus" >> atan(tan(11.0 + 30.0*I)); Error: PARI failure! Please report to bugs@mupad.de or use the fill-in-form http://www.mupad.de/bugmailer.html ; in procedure 'atan' >> # 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 &> # >> w:= (z + 1/z)/2; z 1 - + --- 2 2 z Time: 540 msec Type: "_plus" >> xpr:= w + sqrt(w + 1)*sqrt(w - 1); z 1 / z 1 \1/2 / z 1 \1/2 - + --- + | - + --- - 1 | | - + --- + 1 | 2 2 z \ 2 2 z / \ 2 2 z / Time: 260 msec Type: "_plus" >> simplify(xpr); / 2 \1/2 / 2 \1/2 z 1 | (z - 1) | | (z + 1) | - + --- + | -------- | | -------- | 2 2 z \ 2 z / \ 2 z / Time: 9060 msec Type: "_plus" >> w:= NIL: >> xpr:= NIL: >> # ---------- Quit ---------- # >> quit real 102.16 user 100.57 sys 1.02