in reply to getting a cube root
All the replies posted so far finds a real root. Is there a method to find complex roots as well? Math::Complex doesn't seem to cut it.
Update: As pointed out below, c=r^(1/n)*e^(2*pi*i*j/n) (for j=0,1,...,n-1) will do the trick, but I was thinking someone should have written an easy access to the roots, as in:
to give all the n-th roots of $real. Hmmm.... This shouldn't be too difficult. I'll leave it as exercise to the reader. :)@roots=complex_roots($real, $n)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: getting a cube root
by snax (Hermit) on Oct 08, 2003 at 20:06 UTC |
In Section
Seekers of Perl Wisdom