Raising a complex base to a rational exponent,
numerically.
Underlying assumption:
Such 'roots' number (q), if the exponent was (p/q),
and if (p,q) are integers with a GCD of (1).
Therefore, the best that can be accomplished is,
that an arbitrary 'first' exponent be computed, and
that, in order to find the additional roots, that
first exponent be rotated in the complex plane.
An expression is later to be raised to (1/3), that is already
familiar, and that goes as follows:
(%i1) | expr : ((sqrt(5003)*%i)/6+709/54); |
Approach:
Compute logarithm, resulting in one complex number,
Multiply by (p/q),
Compute antilogarithm.
Catch:
The logarithmS of a complex number comprise
an infinite series, differing from one solution to
the next by (2*%pi*%i).
(%i2) |
ComplexLog(cc, n) := float(log(cabs(cc))) + (carg(cc) + 2 * %pi * n) * %i$ |
The following should be a simple example,
in which the polar angle of the argument,
in the complex plane, is 45⁰:
(%i3) | ComplexLog(sqrt(0.5) * (1 + %i), 0); |
(%i4) | ComplexLog(sqrt(0.5) * (1 + %i), 1); |
(%i5) |
ComplexExp(cc) := float(exp(realpart(cc)) * cos(imagpart(cc))) + %i * float(exp(realpart(cc)) * sin(imagpart(cc)))$ |
(%i6) | ComplexExp(%o3); |
(%i7) | ComplexExp(%o4); |
(%i8) |
ComplexPow(cc, r, n) := ComplexExp(ComplexLog(cc, n) * r)$ |
In this case, the polar angle is being changed,
from 45⁰ to 30⁰, by exponentiation to 2/3:
(%i9) | ComplexPow(sqrt(0.5) * (1 + %i), 2/3, 0); |
(%i10) | ComplexPow(sqrt(0.5) * (1 + %i), 2/3, 1); |
(%i11) | ComplexPow(sqrt(0.5) * (1 + %i), 2/3, 2); |
Finally, the case from a previous exercise:
(%i12) | H : [0.0, 0.0, 0.0]$ |
(%i13) |
for i : 1 thru 3 do ( H[i] : ComplexPow(expr, 1/3, i-1) )$ |
(%i14) | H; |
Validation:
(%i15) | Roots: [0.0, 0.0, 0.0]$ |
(%i16) |
for i : 1 thru 3 do ( Roots[i] : rectform(H[i] + 61 / (9 * H[i]) + 8/3) )$ |
(%i17) | Roots; |
(%i18) |
ProductSeries(list) := block ( product : 1, for elem in list do ( product : product * -elem ), rectform(product) )$ |
(%i19) | ProductSeries(Roots); |
Again, the exact answer, corresponding to the constant term,
was +9 .
(%i20) | Poly(x) := rectform(x^3-8*x^2+x+9); |
(%i21) | poly_values : map(Poly, Roots); |
In general, the phenomenon was happening, that
values close to 10^-14 or 10^-16 were being generated,
that could be seen as equivalent to zero, but
that were not so, just due to arithmetic round-off errors.
The last list above, is essentially equivalent to a list
of 3 zeros, each with an imaginary and a real component.