Are complex numbers used in programming? If they are what is their significance? What IDEs and languages use them? And would it be recommended to learn how to implement them for a programming job (if so please specify what job)?

I've been working in Eclipse and just studied the importance of complex numbers in math and wondered if it correlated.

  • 7
    Remember that an IDE is a tool like a typewriter: it helps you write code, but it doesn't care what the code does any more than a typewriter cares about poetry. You can write code that uses complex numbers in any language that lets you create pairs of numbers and do basic arithmetic.
    – Caleb
    Commented Nov 9, 2011 at 4:49

2 Answers 2


Yes, but only in some of those languages popular with physicists, electrical engineers, and anyone of the sort who would have a beer with them. Complex numbers are especially useful in electronics, optics, and quantum theory for describing waves and any periodic phenomena. Fourier transforms use complex numbers and are the key to working with wavefunctions, designing filters, signal integrity in digital electronics, radio astronomy, and on and on...

The languages "D" (from Digital Mars), Python, IDL, Matlab (and Octave), APL, J, C (since C99), and Fortran have complex numbers built in. There are probably more. By "built in" we mean that one can write mathematical expressions with the same ease as when using plain floating point values, declare arrays of that type, and not having to work through some API or set of classes and methods even if syntactic sugar hides it. The compiler can optimize in ways not possible with a library.

Python is especially good to EEs by using "j" as the unit imaginary instead of the usual "i" used in math and physics.

Most other languages allow one to use complex numbers in the form of libraries. These include C, C++, Java, Ruby, perl, at least, among languages scientists and engineers have some likelihood of using.

I don't know about functional languages such as Haskell, in what manner they support complex numbers.

Programming for business, web apps, smartphones, and games rarely has any use for complex numbers. When they do, it's probably for some sort of audio or image analysis - science and engineering stuff - as part of some app. Languages that cater only to these industries might have complex libraries, but more likely don't support them at all. OTOH, it wouldn't surprise me if some smartass in the past had created a complex numbers library for COBOL.

  • j is often used in electronics instead of i, and I've also seen it in a few physics textbooks. It's an accepted alternative.
    – jwenting
    Commented Apr 24, 2014 at 9:34
  • In electronics i or I is reserved as a variable for current, so j is for the complex part of a number. Commented Apr 24, 2014 at 14:44

Complex Numbers show up all over the place in Computer Science and Engineering as well as Scientific Computing. Examples include Fast Fourier Transforms for Signal Processing, Circuit Simulation (Complex Numbers are very common in Electrical Engineering), and Fractals which get used in Graphics and various other fields. They also show up a lot in Physics programming as Complex Numbers have some very interesting relations to vectors and trigonometry. This linkage is critical to Euler's Identity: e^(ipi)+1=0

You'd cover complex numbers in a huge variety of courses ranging from Electrical Engineering to Numerical Analysis. Most modern or even many older languages can handle Complex numbers, usually by use of a library. C99 for instance has complex.h. Haskell on the other end of the spectrum also does with the Complex Module.

As far as importance, I'd learn them and well if you do anything with hardware, embedded systems, physics, graphics, computer vision, signal processing, computational mathematics, data compression or simulation. Anything that leans hardware or scientific really.

Not the answer you're looking for? Browse other questions tagged or ask your own question.