Complex numbers in JavaScript.
Include Complex.js file in your JavaScript project:
<script type="text/javascript" src="Complex.js"></script>
Then you will be able to use the Complex Numbers Library.
Create a new Complex number:
var number1 = new Complex("2+3i");
var number2 = new Complex("9-1i");
var number3 = new Complex("1.3832-9.87i");
// Add number1 to number2
var result = number1.add(number2);
// Subtract number1 from number2
var result = number1.sub(number2);
// Product
var result = number1.mul(number2);
// Division
var result = number1.div(number2); // number1/number2
// Module
var module = number3.abs();
// Angle
var angle = number3.angle();
- Addition
- Subtraction
- Multiplication
- Division
- Module
- Angle
- Pow
- Exponent
- Sin
- Cos
- Tan
- Sinh
- Cosh
- Tanh
- Log
- Complex Array Operations
- Complex Matrix Operations
- Object and operations optimization.