help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fractional powers


From: Mario Storti
Subject: Re: fractional powers
Date: Tue, 12 Nov 1996 17:29:12 -0300

> I'm somewhat disturbed by the following behaviour on octave.  Perhaps it
> is standard and I shouldn't be worried but it surprised me.  Consider the
> following question: what is the cube root of -1?  Clearly the answer
> should be -1.  Now ask octave
>
> octave:1> x = (-1)^(1/3)
> x = 0.50000 + 0.86603i
>
> it gets wierder if you now cube that number
>
> octave:2> x^3
> ans = -1.0000e+00 + 1.2246e-16i
>
> This is pretty close to the truth but still strange to my way of thinking.
> Similar wierdness shows up with other fractional powers: 1/5, 1/7, etc.
>
> Any thoughts?
>
>   Heber Farnsworth                               | Department of Finance
>   Univerity of Washington                        | Box 353200
>   tele:  (206) 528-0793 home                     | Seattle, WA 98195-3200
>   tele:  (206) 543-4773 finance     web: http://weber.u.washington.edu/~heberf
>   fax:   (206) 685-9392             email: address@hidden
>

I think that Octave, Matlab and all  the others (even Fortran! I tried
it right now!!.) performs z^(1/3) as:

                z^(1/3)=exp(1/3*log(z))

log(z) is multi-valued and the standard definition is log(z) real over
the positive real axis  and  with a branch-cut   in the negative  real
axis. For z strictly on the negative real axis it gives:

               log(z)=log(|z|) + i*pi

and then z^(1/3) is computed as:

                 z^(1/3)=exp(1/3*(log(|z|) + i*pi))
                        =|z|^(1/3)* exp(i*pi/3)

which is the solution given by Octave. If you add a small negative
imaginary part, then you cross the branch-cut and then:

               log(z)=log(|z|) - i*pi

and the result will be:

                 z^(1/3)=exp(1/3*(log(|z|) - i*pi))
                        =|z|^(1/3)* exp(-i*pi/3)

>    octave:9> (-1-i*1e-15)^(1/3)
>    ans = 0.50000 - 0.86603i

Mario

%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%
Mario Alberto Storti               | Fax: (54)(42) 55.09.44               |
Grupo de Tecnologia Mecanica       | Tel: (54)(42) 55.91.75               |
INTEC, Guemes 3450 - 3000 Santa Fe | http://venus.unl.edu.ar/gtm-eng.html |
Argentina                          | Home: Gob. Vera 3161                 |
Reply: address@hidden  |       (54)(42) 55.00.23              |


reply via email to

[Prev in Thread] Current Thread [Next in Thread]