So I wanted to programmatically do complex logarithms on complex rationals.

But how?Taylor series isn't fast enough(also it doesnt converge on complex domain and has limited range on real domain),so we can separate the input into argumant and magnitude.Then we have to find the easy logarithm of the magnitude and add it to arg times pi i.

But how?Easy logarithms and argument finding are hard(arctans don't have nice taylor series either).If we use the arctan logrithmitic formulation,then we will need complex logarithms to do that.

Looks like that your username is a bit disrespectful to Newton,so lets bring the Newton-~~Raspberry~~Raphson method to the mix.

lnx=lnx-f(lnx)/f'(lnx)

where f(y)=e^y-x and lnx is what we want to solve.

so it is equivalent to lnx=lnx-1+x/e^lnx

Check:assuming that we know what lnx is,it simplifies to lnx=lnx which is correct.

Time complexity:O(p1p2) where p1 is the number of iterations and p2 is the number of lnx^n/n! in the partial of the taylor series of exp

I searched for the same problem in Google and found this Python script which can illustrate this approach.

May be it can work for you.

```
import cmath # Complex math library in Python
# Complex rational number (a + bi)
a = 2.0
b = 3.0
# Separate magnitude and argument
r = abs(complex(a, b))
theta = cmath.phase(complex(a, b))
# Calculate logarithm of magnitude
log_r = cmath.log(r)
# Construct complex logarithm
log_z = log_r + theta * 1j
print("Logarithm of", complex(a, b), "is", log_z)
```

Thanks

No,it invokes the phase function,which is calculated using complex logarithms