sqrt, abs, radcan. Re: maxima bug



I agree in principle. We could perfectly well have
     solve(x^k=a,x)
return
     [x=abs(a)^(1/k)*%e^(2*%i*%pi*%n23/k)]
for positive a -- and %n23 would be declared integer.

Current value is simply [x=a^(1/n)] (if n declared integer), which isn't
correct even for the pure real case, since for even n there should be two
real solutions.

As is often the case, the tradeoff is between simplicity and
completeness/correctness.  Will our elementary users find the complex
exponential useful?  Presumably not, so we'd need to have the feature be
controlled by a flag (perhaps the existing domain:complex flag?).

It would also be more useful if we'd improve the simplification of exp --
declare(n,integer)$ %e^(2*%i*%pi*n) currently doesn't simplify to 1.

               -s

On Sat, Mar 17, 2012 at 15:33, Mike Valenzuela <mickle.mouse at gmail.com>wrote:

> I just thought I'd throw in my two cents.
>
> Some would say that polar form is a more "natural" way to treat powers and
> roots:
> x+%i*y --> r*exp(%i*theta) --> r*exp(%i*theta + 2*n*%i*%pi),
> where r = positive value of sqrt(x^2 + y^2), theta = atan2(x,y), and n is
> an integer.
>
> Then taking a root produces multiple answers:
> (  r*exp(%i*theta + 2*n*%i*%pi) )^(z) = r^(z) * exp(%i*theta*z +
> 2*n*%i*%pi*z),
> where r^z only has to worry about the "simple case" returning a real
> positive value. Then the trick is to run through as many integers of n as
> we care about. If z is rational number, then an finite set of n covers all
> possible outputs. I believe (although I ask someone fact check this), if z
> is irrational, then there are infinitely many answers.
>
> Here is a less symbolic example (assuming sqrt returns the positive value):
> ( 1/sqrt(2) + %i/sqrt(2) )^(1/3) =
> ( 1 * exp( %i*pi/4 + 2*%i*%pi*n ) )^(1/3) =
> ( 1 * exp( %i*pi/12 + 2*%i*%pi*n/3 ) ) =
>
> {
>   cos(%pi/12) + %i*sin(%pi/12),
>   cos(%pi*9/12) + %i*sin(%pi*9/12),
>   cos(%pi*17/12) + %i*sin(%pi*17/12)
> }
>
> The moral of my story - the polar form with a factor of +2*n*pi*i reveals
> that there are potentially multiple answers to general powers other than
> just square root.
>
>
> On Sat, Mar 17, 2012 at 7:25 AM, Richard Fateman <
> fateman at eecs.berkeley.edu> wrote:
>
>> On 3/16/2012 4:06 PM, Rubens Marinho wrote:
>>
>>> Dear all,
>>>
>>> radcan do understand assume and do it correctly.
>>> consider de code
>>>
>> 1. The radcan program does not use the assume facility. The simplification
>> that is done on the argument to radcan is outside the radcan program.
>>
>> 2. If you say   assume(z<0)
>> then sqrt(z^2) comes out -z.
>> This has nothing to do with radcan.
>>
>> This is a consequence of sqrt(z^2) being simplified to abs(z), and abs(z)
>> simplifying to -z.
>>
>> I think it is an error to simplify sqrt(z^2) to abs(z). To avoid this
>> error in
>> the case that there are no assumptions on z, set radexpand:false.
>>
>> Unfortunately this is insufficient protection against mathematical errors
>> in Maxima's current setup.   Sqrt(9) is {3,-3}, and if you forget it you
>> will get wrong answers sometimes.
>>
>>
>>
>>
>> ______________________________**_________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>;
>>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>