Re: nth roots of complex numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg39106] Re: nth roots of complex numbers
- From: Friedrich Laher <mathefritz at schmieder-laher.de>
- Date: Wed, 29 Jan 2003 03:38:29 -0500 (EST)
- References: <b10ddh$mou$1@smc.vnet.net> <b11sb8$p7v$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Friedrich Laher schrieb: > Zachary Turner schrieb: > >>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} >> >> >> > > > LstOfRoots[z_, n_] := > Module[{a = Abs[z]^(1/n), f}, f[i_] := a Root[#^n - 1, i]; Map[f, > Range[n]]] I am ashamed to admit that the above one is only valid for real z Here is a more general solution - assuming an natural n. The exponential form is best for calculating roots. LstOfRoots[z_, n_] := Block[{az = Arg[z], r = Abs[z]^(1/n), j, ang = \[ImaginaryI](az + 2\[Pi] j)/n}, Table[r \[ExponentialE]^ang, {j, 0, n - 1}]}] I 1st tried the names arg and abs ang ( angle ) and r ( "radius" ) but that is rejected by mathematica.