-8

I am working on a math project.I need a programming language that allows me to evaluate users input. Like Multiplying 2 complex numbers: I can't use a regular expression since there are many possibilities( I want to include all the steps of calculation.)

Joni
  • 108,737
  • 14
  • 143
  • 193
neo
  • 13
  • 2

1 Answers1

1

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 use I as the imaginary unit. See also How to work with complex numbers in C?
Community
  • 1
  • 1
Joni
  • 108,737
  • 14
  • 143
  • 193