solve and nth roots of ( - 1 )



On  May 19, 2009, on thread "ratsimp bad,  rectform good",
  Edwin Woollett wrote:
    " Maxima's solve function can return a solution in terms of z = 
        (-1)^(1/n), which  is any (in general complex) number z   
        such that z^n = -1. "

On May 20, 2009, on the same thread, Richard Fateman wrote:
  "  Actually, I think the expression (-1)^(1/6) in Maxima is not "any" 
         number z such that z^6=-1.  It is a particular one.
        Just as 3^(1/2) is  only the positive value.  This is a notational 
        issue, and Maxima is not, generally, able to deal with
         multiple values."

Let's look at the 4th roots of ( - 1 ) as an example.

 solve ( a^4 + 1) returns a list of four answers, each
  with a  factor  ( - 1 )^(1/4).  Since the latter factor
 can be four possible complex numbers, one might
 think that maxima is returning more than four  answers.

For some reason, solve offers the user the choice of
replacing  ( - 1 )^(1/4)  (using ratsubst, say) throughout 
the list with a single choice and that will result in a list of
four complex numbers.

For any user choice, you get the same list of four
complex numbers, just in a different (cyclic) order.

Here is code for exploration of the case n = 4.

(%i1) display2d:false$

   usual definition of 4th roots of (-1), with k = 1, 2, 3, 4.

(%i2) v(k):= factor (ratsimp ( 
                       rectform (exp( %i*%pi*( -1 + 2*k)/4))))$

   display these  as a simplified list:

(%i3) q: fullmap ('rootscontract, makelist ( v(k), k, 1, 4));

(%o3) [ 2^-(1/2)*(%i+1),  (%i-1)/sqrt(2),
                  -2^-(1/2)*(%i+1),  -(%i-1)/sqrt(2) ]
 
  check roots:

(%i4) ratsimp ( q^4 );
(%o4) [-1,-1,-1,-1]

   Now ask solve for the 4th roots of (-1):

(%i5) s : factor (map ( 'rhs, solve ( a^4 + 1 )));

(%o5) [ (-1)^(1/4)*%i,   -(-1)^(1/4),   
                        -(-1)^(1/4)*%i,   (-1)^(1/4)   ]

   note presence of factor (-1)^(1/4) in each element

check solutions

(%i6) ratsimp(s^4);
(%o6) [-1,-1,-1,-1]

   define four particular solutions p[k] by replacing (-1)^(1/4) by
              q[k] defined above
 
(%i7) for k thru 4 do 
                  p[k] : factor (ratsubst ( q[k], (-1)^(1/4), s ))$

   show k,  p[k],  p[k]^4, and finally that p[k]
    is really the same as the list q defined above, but just
    in a different order.
  
(%i8) for k thru 4 do
        (print("   ", k,"  ",  p[k]),
           print("        ", ratsimp ( p[k]^4 ),
             "  ",  ratsimp ( sort ( p[k] ) - sort ( q ))))$

    1    [ (%i-1)/sqrt(2), -(%i+1)/sqrt(2),  
                    -(%i-1)/sqrt(2),  (%i+1)/sqrt(2) ] 
                   [-1,-1,-1,-1]    [0,0,0,0] 

    2    [ -(%i+1)/sqrt(2),  -(%i-1)/sqrt(2),  
                         (%i+1)/sqrt(2),  (%i-1)/sqrt(2) ] 
                    [-1,-1,-1,-1]    [0,0,0,0] 

    3    [ -(%i-1)/sqrt(2),   (%i+1)/sqrt(2), 
                       (%i-1)/sqrt(2),   -(%i+1)/sqrt(2)] 
                   [-1,-1,-1,-1]    [0,0,0,0] 

    4    [ (%i+1)/sqrt(2),   (%i-1)/sqrt(2),  
                       -(%i+1)/sqrt(2),   -(%i-1)/sqrt(2) ] 
                   [-1,-1,-1,-1]    [0,0,0,0] 
         
    Finally,  let pr be the list of 4th roots if we just rectform the
     list of solutions returned by solve, thus using maxima's default
     choice for ( -1 )^( 1/n ) for n even.
  
(%i9) pr : factor ( rectform (s) );

(%o9) [ (%i-1)/sqrt(2),   -(%i+1)/sqrt(2),  
                     -(%i-1)/sqrt(2),   (%i+1)/sqrt(2) ]

   check solution
(%i10) ratsimp ( pr^4 );
(%o10) [-1,-1,-1,-1]

   show it is just the particular solution p[1]:

(%i11) ratsimp ( pr - p[1] );
(%o11) [0,0,0,0]

=============================
A similar exploration can be made for any even n
with obvious changes.

Ted Woollett