In python, you can put ‘j’ or ‘J’ after a number to make it imaginary, so you can write complex literals easily:

>>> 1j
1j
>>> 1J
1j
>>> 1j * 1j
(-1+0j)

The ‘j’ suffix comes from electrical engineering, where the variable ‘i’ is usually used for current. (Reasoning found here.)

The type of a complex number is complex, and you can use the type as a constructor if you prefer:

>>> complex(2,3)
(2+3j)

A complex number has some built-in accessors:

>>> z = 2+3j
>>> z.real
2.0
>>> z.imag
3.0
>>> z.conjugate()
(2-3j)

Several built-in functions support complex numbers:

>>> abs(3 + 4j)
5.0
>>> pow(3 + 4j, 2)
(-7+24j)

The standard module cmath has more functions that handle complex numbers:

>>> import cmath
>>> cmath.sin(2 + 3j)
(9.15449914691143-4.168906959966565j)
Answer from rob mayoff on Stack Overflow
Discussions

Why are complex numbers in Python denoted with 'j' instead of 'i'? - Stack Overflow
I know this is an electrical engineering convention, but I'm still wondering why it was chosen for Python. I don't know other programming languages with complex-number literals, so I don't have any... More on stackoverflow.com
🌐 stackoverflow.com
Since python interpret 'j' as the imaginary number by default, shouldn't it be a reserved word?
That NameError makes perfect sense. Python 2.7.4 (default, Apr 19 2013, 18:28:01) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> j Traceback (most recent call last): File "", line 1, in NameError: name 'j' is not defined >>> 1j 1j >>> 2j 2j More on reddit.com
🌐 r/Python
4
0
July 19, 2013
Should Python support i suffix for complex numbers as well as j ?
It's a nice feature for mathematicians used to i instead of j. But of all users, mathematicians are the best able to cope with a trivial change in notation. It's not worth breaking any code, or preventing the use of both i and j for quaternions. Could customising the suffices be included as a flag or environment variable? More on reddit.com
🌐 r/Python
20
7
May 20, 2022
why is csvread returning complex numbers?
The fact that your initial 100 numbers are turned into 91 complex numbers tells me that something weird happens when reading. I suspect that there is some irregularity in that .csv file such that Matlab considers some of the actual numbers as the imaginary part of another number. That should be the case for 9 numbers. You might want to check if really all of the read 1x91 numbers are purely real. Let's say that you called the 1x91 matrix within Matlab "A". Use any(imag(A)) to see if any of the imaginary parts is non-equal to zero. If so, you probably want to have a look at your .csv file in the notepad to see where the irregularity might come from. Extra bit: If I define a matrix as A = [5+1e-12i, 2; 1, 1] in Matlab, I will receive A = 5.0000 + 0.0000i 2.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i So a very small imaginary part can cause the additional 0 for all numbers. More on reddit.com
🌐 r/matlab
7
4
January 15, 2018
🌐
Real Python
realpython.com › python-complex-numbers
Simplify Complex Numbers With Python – Real Python
October 21, 2023 - The traditional notation for complex numbers uses the letter i instead of j since it stands for the imaginary unit. You might feel a slight discomfort with Python’s convention if you have a mathematical background.
Top answer
1 of 9
74

It appears to be, as you guessed, because Python follows the electrical engineering convention. Here's an exchange from the Python bug tracker Issue10562:

Boštjan Mejak: In Python, the letter 'j' denotes the imaginary unit. It would be great if we would follow mathematics in this regard and let the imaginary unit be denoted with an 'i'.

Michael Foord: We follow engineering which uses j.

(I was about to close this as wontfix but Antoine is particularly keen that Mark deals with this issue...)

Mark Dickinson: Just to add my own thoughts: 'j' for a (not the ) square root of -1 has, as Michael points out, a history of use in engineering (particularly electrical engineering) and physics. Personally, I would have preferred 'i' to 'j' here, but changing it now would cause (IMO) gratuitous breakage. It really doesn't seem a big enough issue to be worth making a fuss about.

...

Much later:

Guido van Rossum: This will not be fixed. For one thing, the letter 'i' or upper case 'I' look too much like digits. The way numbers are parsed either by the language parser (in source code) or by the built-in functions (int, float, complex) should not be localizable or configurable in any way; that's asking for huge disappointments down the road. If you want to parse complex numbers using 'i' instead of 'j', you have plenty of solutions available already.

2 of 9
21

Python adopted the convention used by electrical engineers. In that field, i is used to represent current and use j as the square root of -1.

There was a bug logged to change it to i in Python 3.3. It was resolves as a "WONTFIX" with this reasoning by Guido van Rossum:

This will not be fixed. For one thing, the letter 'i' or upper case 'I' look too much like digits. The way numbers are parsed either by the language parser (in source code) or by the built-in functions (int, float, complex) should not be localizable or configurable in any way; that's asking for huge disappointments down the road. If you want to parse complex numbers using 'i' instead of 'j', you have plenty of solutions available already.

🌐
Python
docs.python.org › 3 › library › cmath.html
cmath — Mathematical functions for complex numbers
This module provides access to mathematical functions for complex numbers. The functions in this module accept integers, floating-point numbers or complex numbers as arguments. They will also accep...
🌐
Note.nkmk.me
note.nkmk.me › home › python
Complex Numbers in Python | note.nkmk.me
August 10, 2023 - In Python, the imaginary unit for complex numbers is represented as j, not i.
Find elsewhere
🌐
Python Engineer
python-engineer.com › posts › complex-numbers-python
Complex Numbers in Python - Python Engineer
February 18, 2022 - Complex numbers are created from two real numbers. You can create it directly or you can use the complex function. It is written in the form of (x + yj) where x and y are real numbers and j is an imaginary number which is the square root of -1.
🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › complex
complex — Python Reference (The Right Way) 0.1 documentation
Imaginary numbers are real multiples of the imaginary unit (the square root of -1), often written i in mathematics or j in engineering. Python has built-in support for complex numbers, which are written with this latter notation; the imaginary part is written with a j suffix, e.g., 3+1j.
🌐
Python Basics
python-basics-tutorial.readthedocs.io › en › latest › types › numbers › complex.html
Complex numbers - Python Basics
Python expresses the resulting ... x (6+58j) >>> x.real 6.0 >>> x.imag 58.0 · Complex numbers consist of a real part and an imaginary part with the suffix j....
🌐
AskPython
askpython.com › home › python complex numbers
Python Complex Numbers - AskPython
August 6, 2022 - A Complex Number is any number of the form a + bj, where a and b are real numbers, and j*j = -1. In Python, there are multiple ways to create such a Complex Number.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-complex-function
Python complex() Function - GeeksforGeeks
July 23, 2025 - python uses 'j' instead of 'i' (used in mathematics) to represent imaginary numbers. We can access the real and imaginary parts of the complex numbers using .real and .imag methods respectively.
🌐
Python Guides
pythonguides.com › complex-numbers-in-python
Complex Numbers In Python
March 24, 2025 - Before getting into Python’s implementation, let us learn what are complex numbers. ... In Python, we use j instead of i (following the convention in electrical engineering), so a complex number is represented as a + bj.
🌐
Luis Llamas
luisllamas.es › inicio › cursos › curso python
Complex Numbers in Python
November 20, 2024 - In Python, complex numbers are represented using the form a + bj, where a and b are real numbers, and j is the imaginary unit (√-1).
🌐
Programiz
programiz.com › python-programming › methods › built-in › complex
Python complex()
If the string passed to this method is not a valid complex number, ValueError exception is raised. Note: The string passed to complex() should be in the form real+imagj or real+imagJ · z = complex(2, -3) print(z) z = complex(1) print(z) z = complex() print(z) z = complex('5-9j') print(z)
🌐
Wm
cs.wm.edu › ~rml › teaching › python › variables › numeric › complex.html
complex
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-2-b20801048b85> in <module>() ----> 1 z = j # j by itself is treated as the name of a variable! 2 print(z) NameError: name 'j' is not defined · Let's set a variable to the complex value $1 + 2j$.
🌐
Aims
python.aims.ac.za › pages › complex.html
18. Complex type, I — AIMS Python 0.7 documentation
If we write 1+j, Python will treat j as a variable that must have been defined above; we would have to write 1+1j to denote a complex number (assuming we hadn't defined a complex-valued variable j previously...).