You could use Scheme, it’s a nice Lisp-like language that has built-in support for complex numbers. Also, since in Scheme data is code, it is really easy to turn user input into executable code.
Chicken Scheme is a popular variant.
Other popular languages with built-in complex number support are:
- R: use
i
as suffix for imaginary numbers.(1+2i)^2
returns-3+4j
. - Python: use
j
as a suffix for imaginary numbers.(1+2j)**2
returns(-3+4j)
. - Ruby: use the
Complex
class. - C: include
complex.h
and useI
as the imaginary unit. See also How to work with complex numbers in C?
1
solved complex numbers [closed]