I've off and on been searching for an answer for this. I am in request for an algorithm that can calculate all nth roots of b. At the least, n being real positive integer, and b being at the least of real positive; although if possible, b being complex, and not even sure if possible, but n too?
Example:
4th roots of 16 = 2, -2, 2i, -2i
For those who are curious, my reason for the request is for just a smart calculator, and possibly a relation grapher afterwords.
I can figure it out with a little bit of complex factoring by hand, but that would be pretty hard to program imo. Too scared to give it a try, lol. Ex:
4th roots of 1
x^4 = 1
x^4-1 = 0
(x-1)(x+1)(x^2+1) = 0
(x-1)(x+1)(x-i)(x+i) = 0
x = -1, 1, -i, i
4th roots of 4
x^4 = 4
x^4-4 = 0
(x^2-2)(x^2+2) = 0
(x^2-2)(x+sqrt(2)i)(x-sqrt(2)i) = 0
(x^2-2)(x+sqrt(2)i)(x-sqrt(2)i) = 0
(x+sqrt(2))(x-sqrt(2))(x+sqrt(2)i)(x-sqrt(2)i) = 0
x = sqrt(2), -sqrt(2), sqrt(2)i, -sqrt(2)i
(note that commas separate possible values for x)
I've been trying cube roots of 1, but I got stuck while factoring.. I'm not the best at that factoring
x^3 = 1
x^3-1 = 0
(x-1)(x^2+x+1) = 0
I guess I could just use the quadratic formula, but I'm trying to avoid that.
so x = 1, and 2 other complex #s
As you can tell, I'm giving the answers in exact form, i don't really need this for what im doing...