simplification of number ^ number



 On 10/5/10 8:22 AM, Barton Willis wrote:
> The option variables domain, numer, numer_pbranch, and m1pbranch control the simplification of number^number.
> These options are documented, but it's a mess; examples:
>
>  (%i40) block([domain : real, m1pbranch : false, numer_pbranch : false, numer : true], (-5.0)^(1/2));
>  (%o40) 2.23606797749979*(-1)^0.5
>
>  (%i41) block([domain : real, m1pbranch : false, numer_pbranch : false, numer : false], (-5.0)^(1/2));
>  (%o41) 2.23606797749979*%i
This is really confusing!  I would have expected the opposite results,
where numer:true would produce 2.236*%i.  Maybe numer is supposed to do
that, but I find it confusing.

> The option variable m1pbranch controls the simplification of (-1)^x, but it's unclear to a user when (-1)^x
> will be introduced into a calculation.
>
> You all might enjoy trying pow(-5,1/2), pow(-5.0, 1/2), pow(-5.0, 1/3), pow(-5.0, 0.333333333333), ...
>
> pow(x,y) := block([l : []],
>   for d in ['real, 'complex] do (
>    for n in [false, true] do (
>      for pb in [false,true] do (
>         for m1 in [false,true] do (
>           block([domain : d, m1pbranch : m1, numer_pbranch : pb, numer : n], 
>                 l : cons([x^y, domain, m1pbranch, numer_pbranch, numer],l)))))),
>    l : cons(['(x^y),'domain, 'm1pbranch, 'numer_pbranch, 'numer],l),
>    funmake('matrix, l))$
>
> I was thinking about the possibility of using the bigfloat package to do more evaluation of number^number.
> But the 16 values for domain, numer, numer_pbranch, and m1pbranch make it complicated.
Perhaps it's finally time to sit and think and rationalize all of
these.  I think there are several bug reports about how float() and
numer : true produce confusing results.

Ray