Subject: couple of questions about complex expressions
From: Barton Willis
Date: Tue, 25 Sep 2012 10:38:22 +0000
It's a mess. I think domain : complex and m1pbranch : true is supposed to give the principle branch,
and domain : real and m1pbranch : false the real branch, I think. But sometimes numer matters (and maybe
radexpand too)
OK -- real branch:
(%i8) block([domain : real, m1pbranch : false], (-8)^(1/3));
(%o8) -2
Not OK -- principle branch (more-or-less)
(%i9) block([domain : real, m1pbranch : false, numer : true], (-8)^(1/3));
(%o9) 2.0*(-1)^0.33333333333333
(%i10) rectform(%);
(%o10) 2.0*%i*sin(0.33333333333333*%pi)+2.0*cos(0.33333333333333*%pi)
Sometimes numer makes a difference:
(%i38) block([domain : complex, m1pbranch : true, numer : true], (-8.0)^(1/2));
(%o38) 2.82842712474619*%i+1.7318549141438711*10^-16
(%i39) block([domain : complex, m1pbranch : true, numer : false], (-8.0)^(1/2));
(%o39) 2.82842712474619*%i
(%i46) block([domain : complex, m1pbranch : true,numer : false], (-8.0)^(0.5));
(%o46) (-8.0)^0.5
The user documentation for the (obscurely named) option variable m1bpranch is clear enough,
but a user doesn't know when a (-1)^power is going to be generated.
I think that domain : larry and m1pbranch : sally gives the principal branch too:
(%i48) block([domain : larry, m1pbranch : sally], (-8)^(1/3));
(%o48) 2*((sqrt(3)*%i)/2+1/2)
Surely one option variable (say use_real_branch) should control all this. And
quotients of complex numbers should automatically simplify to a rectangular form.
The function simpexpt is about 345 lines with about 20 calls to go :(
--Barton
________________________________________
Hi, I've run into a couple of things that I'm wondering about.
(1) principal branch for (-x)^(1/n) when n is an odd integer. I know
we've gone back and forth on this one, and at present it looks like the
real branch is chosen. Is there a way to choose the principal branch?
For the record, m1pbranch doesn't seem to have any effect here.
(2) division of complex literals: how can I get (a + b*%i)/(c + d*%i) =>
e + %i*f when a, b, c, and d are numbers.
I can't seem to cause it to happen. realpart(foo) + %i*imagpart(foo) has
the expected result but it just seems clumsy.
(%i2) foo : (5 + %i)/(3 - 2*%i);
(%o2) (%i+5)/(3-2*%i)
(%i3) expand (foo);
(%o3) %i/(3-2*%i)+5/(3-2*%i)
(%i4) ratsimp (foo);
(%o4) -(%i+5)/(2*%i-3)
(%i5) radcan (foo);
(%o5) -(%i+5)/(2*%i-3)
(%i6) foo, numer;
(%o6) (%i+5)/(3-2*%i)
(%i7) float (foo);
(%o7) (%i+5.0)/(3.0-2.0*%i)
(%i8) expand (float (foo));
(%o8) %i/(3.0-2.0*%i)+5.0/(3.0-2.0*%i)
Thanks for your help,
Robert Dodier
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima