Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get the full list of complex nth roots of a number
| ResourceFunction["ComplexRoots"][x,n] gives a list of the nth roots of a complex number x. | 
Find the three third roots of unity:
| In[1]:= | ![ResourceFunction["ComplexRoots"][1, 3]](https://www.wolframcloud.com/obj/resourcesystem/images/733/733db5b0-3459-451a-b520-a3de4a2b2c3e/28937d9f71923587.png) | 
| Out[1]= |  | 
Find the sixth roots of 2:
| In[2]:= | ![ResourceFunction["ComplexRoots"][2, 6]](https://www.wolframcloud.com/obj/resourcesystem/images/733/733db5b0-3459-451a-b520-a3de4a2b2c3e/6aa75ab132a86fd1.png) | 
| Out[2]= |  | 
Find the fifth roots of -1:
| In[3]:= | ![ResourceFunction["ComplexRoots"][-1, 5]](https://www.wolframcloud.com/obj/resourcesystem/images/733/733db5b0-3459-451a-b520-a3de4a2b2c3e/6cf6b7a1530b65e9.png) | 
| Out[3]= |  | 
Exact values are returned for exact input:
| In[4]:= | ![ResourceFunction["ComplexRoots"][Sqrt[Sin[2]], 5]](https://www.wolframcloud.com/obj/resourcesystem/images/733/733db5b0-3459-451a-b520-a3de4a2b2c3e/12a49ab8a7eb277e.png) | 
| Out[4]= |  | 
Use the resource function ComplexRootQ to confirm the output of ComplexRoots:
| In[5]:= | ![AllTrue[ResourceFunction["ComplexRoots"][1, 3], ResourceFunction["ComplexRootQ"][1, 3]]](https://www.wolframcloud.com/obj/resourcesystem/images/733/733db5b0-3459-451a-b520-a3de4a2b2c3e/6c2d1f87c7566e1b.png) | 
| Out[5]= |  | 
The output of ComplexRoots[1,n] is similar to the output of the resource function PrimitiveRootOfUnityList[n] with the exception that 1 is missing from the latter:
| In[6]:= | ![ResourceFunction["ComplexRoots"][1, 5]](https://www.wolframcloud.com/obj/resourcesystem/images/733/733db5b0-3459-451a-b520-a3de4a2b2c3e/34f063b237f1e288.png) | 
| Out[6]= |  | 
| In[7]:= | ![ResourceFunction["PrimitiveRootOfUnityList"][5]](https://www.wolframcloud.com/obj/resourcesystem/images/733/733db5b0-3459-451a-b520-a3de4a2b2c3e/02987c0954ee7cc8.png) | 
| Out[7]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License