I’ve checked the documentation for python and its’ respective modules and I noticed that there is no predefined complex function to utilize complex numbers. And since you can’t find the square root of any negative numbers, attempting to manually define i, like this:

import math
i = math.sqrt(-1)

just returns an error. Therefore, I was wondering if there is any way to work with complex numbers in python? I’m sure they would be useful in one way or another.

import numpy
i = numpy.lib.scimath.sqrt(-1)
print i

results in the output of 1j. I’ve been trying to get it so that whenever it gets a complex number, to instead print the value in terms of i. I’ve been messing around with it for a while, however I can’t seem to get it to work. Any suggestions?

Right now, I’m just sandboxing around with python. I wasn’t going to add the complex number functionality until I myself understood how it worked within python. Which is why I was wondering if there was a way to instead of displaying the value in terms of j, to display the value in terms of i. I’ve been trying to get that to work for an hour and a half now, and no luck. I mean I’ve gotten it to go as far as turning 1j into a string … "i" but once I do that, I can’t use i in any further computations.