Re: nth roots of complex numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg39364] Re: nth roots of complex numbers
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Wed, 12 Feb 2003 03:54:11 -0500 (EST)
- Organization: The University of Western Australia
- References: <b10ddh$mou$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <b10ddh$mou$1 at smc.vnet.net>, "Zachary Turner" <_NOzturner0826SPAM_ at hotmail.com> wrote: > Apparently Mathematica randomly returns roots a root of a complex number. > Is there a way I can write my own function that will return a set consisting > of all n roots of a given complex number. For example, Root[z,n] = {a set > consisting of n elements} Actually Root is a built-in object -- and it can be used to do what you want. In[1]:= root[n_][z_] := Table[Root[#1^n - z & , k], {k, n}] In[2]:= root[4][1] Out[2]= {-1, 1, -I, I} In[3]:= root[4][1 + I] Out[3]= {Root[#1^8 - 2*#1^4 + 2 &, 1], Root[#1^8 - 2*#1^4 + 2 &, 4], Root[#1^8 - 2*#1^4 + 2 &, 5], Root[#1^8 - 2*#1^4 + 2 &, 8]} In[4]:=N[%] Out[4]={-1.0695539323639858 - 0.21274750472674303*I, -0.21274750472674303 + 1.0695539323639858*I, 0.21274750472674303 - 1.0695539323639858*I, 1.0695539323639858 + 0.21274750472674303*I} Cheers, Paul