How to find nth roots of a complex number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

How to find nth roots of a complex number?

I have a Program called Complex Numbers in C++ - A New Approach. I have most of the functions, except one which helps find nth root of a complex number - like : z^1/5.... Can you please tell me a way to find all n roots for the complex number? It would be a great help... https://code.sololearn.com/cnwyLrbUxc8n/?ref=app

13th Apr 2017, 10:41 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
9 Answers
+ 13
@JPM Please see my Updated Code! It now has everything one may require... https://code.sololearn.com/cnwyLrbUxc8n/?ref=app
14th Apr 2017, 10:35 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 11
@JPM All Thanks to You... ^_^
14th Apr 2017, 11:08 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 11
@JPM Sorry to disturb, a last doubt😅 https://www.sololearn.com/discuss/315095/?ref=app
14th Apr 2017, 11:19 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 10
3) And yes, pow(x,2) may give an unappropriate result
13th Apr 2017, 12:18 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 10
@JPM Thanks for your useful advice!
13th Apr 2017, 12:20 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 10
I have also added log to any base now...
13th Apr 2017, 12:21 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 10
@Krishna Teja Yeluripati I think the Complex header is not so friendly as it involves specification of argument types which is useless in case of complex numbers - no one will use int or char here, then why offer it?
13th Apr 2017, 1:17 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 9
4) Though it can be implemented by a Complex Number with no imaginary value, yours is still more realistic
13th Apr 2017, 12:17 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
13th Apr 2017, 1:11 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar