Edwin Woollett wrote:
> On 19 May 2009, Richard Fateman wrote:
> ---------------------------------------------------
> May be related to your starting expression being ambiguous. There are 6
> values for (-1)^(1/6).
> There are as many as 36 values for the expression. (Though probably
> fewer distinct ones).
> -------------------------------------------------------
> 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.
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.
however,
algebraic:true;
tellrat(a^6+1);
rat(a+1/a) give the result a^5-a.
now there are 6 possible values for a in the complex plane.
a=exp(i pi/ 6) can be put in to a^5-a to get sqrt(3).
a=exp(5 i pi/6) gets -sqrt(3)
a=exp(9 i pi/6) gets 0.
The danger you refer to below is caused by taking a particular value for
the root (instead of the collection of all the roots)
and giving it a name like (-1)^(1/6). The fact that rectform locks in
a specific root means that it may pick one that
is different, in related expressions. e.g. a+1/a are the two a's the
same??
Certainly one way to commit an error is to take one solution from solve
and simplify it in isolation from the other solutions.
Example.
You don't need 6th roots.
Take the solution of a quadratic, which is the two roots
(-b+sqrt(b^2-4ac))/(2a) and
(-b-sqrt(...))
Now you know that there are 2 sqrts of b^2-4ac unless the b^2-4ac is
zero. Assume it is not zero..
If you choose root r for the first formula and choose root -r for the
second formula, you no longer have a
complete solution set.
How to fix all this? You can be rigorous in dealing with algebraic
numbers (in which case you are requiring users of Maxima
to have taken a college course in Modern Algebra). Or you can insist on
multiple-values e.g. + and - sqrts.
Or you can punt.
Maxima, along with other CAS, punts. Unless you use tellrat and friends.
RJF
>
> Since complex roots must occur in pairs, if n is even (such as 6) all
> the roots
> are complex, and rectform, realpart, and imagpart all pick out what I
> will call
> the " k = 0 root", in the sense that the n roots are given by
> exp( %i * %pi * ( 1 + 2*k ) / n ), for k = 0, 1, 2, ..., (n - 1), for
> example.
>
> If solve finds a solution in terms of (-1)^(1/n) for n odd, such as
> (-1)^(1/3),
> maxima always simplifies this to (-1), the one real root, which is
> never the
> "k = 0 " choice.
>
> In other words for n odd the user has no choice, but for n even, the user
> has a choice. One such choice is to use that taken by rectform,
> realpart,
> and imagpart.
>
> The danger here, in working with a solution returned by solve which
> includes unsimplified n'th roots of (-1), is that if you simplify first
> using ratsimp, say, and then use rectform, your final result may be
> different than if you use rectform first, to "lock in" a specific choice.
>
> This is all elementary, but can bite, and cause wasted time if one
> does not recognise the danger.
>
> Here is a simple example of this possible source of confusion:
>
> (%i1) display2d:false$
>
> (%i2) z (n) := (-1)^(1/n)$
>
> (%i3) e : z(6) + 1/z(6);
>
> (%o3) (-1)^(1/6)+1/(-1)^(1/6)
>
> (%i4) ratsimp (rectform (e));
>
> (%o4) sqrt(3)
>
> (%i5) rectform (ratsimp (e));
>
> (%o5) 0
>
> (%i6) ratsimp (e);
>
> (%o6) 0
> ================
>
> and here is simple code for explorations
>
> (%i7) rr (x) := ratsimp (rectform (x))$
>
> (%i8) v(n,k) :=
> block( [fac],
> fac: ratsimp ( (1 + 2*k)/n),
> rr (exp ( %i*%pi*fac )))$
>
> (%i9) vals (n) := for i:0 thru (n-1) do print (i," ",v(n,i))$
>
> (%i10) z(3);
> (%o10) -1
> (%i11) vals(3)$
> 0 (sqrt(3)*%i+1)/2
> 1 -1
> 2 -(sqrt(3)*%i-1)/2
>
> (%i12) z(4);
> (%o12) (-1)^(1/4)
>
> (%i13) rr(%);
> (%o13) (sqrt(2)*%i+sqrt(2))/2
>
> (%i14) vals(4)$
> 0 (sqrt(2)*%i+sqrt(2))/2
> 1 (%i-1)/sqrt(2)
> 2 -(sqrt(2)*%i+sqrt(2))/2
> 3 -(%i-1)/sqrt(2)
>
> (%i15) z(5);
> (%o15) -1
>
> (%i16) vals(5)$
> 0 %i*sin(%pi/5)+cos(%pi/5)
> 1 %i*sin(3*%pi/5)+cos(3*%pi/5)
> 2 -1
> 3 cos(3*%pi/5)-%i*sin(3*%pi/5)
> 4 cos(%pi/5)-%i*sin(%pi/5)
>
> (%i17) z(6);
> (%o17) (-1)^(1/6)
>
> (%i18) rr(%);
> (%o18) (%i+sqrt(3))/2
>
> (%i19) vals(6)$
> 0 (%i+sqrt(3))/2
> 1 %i
> 2 (%i-sqrt(3))/2
> 3 -(%i+sqrt(3))/2
> 4 -%i
> 5 -(%i-sqrt(3))/2
>
> ==================
> Ted Woollett
> p.s. ratsimp is not bad and rectform is not bad ;)
>
>