DefinitelyTyped/types/complex/complex-tests.ts
Nathan Shively-Sanders 708214ef04 Change 'export default' to 'export =', part 2 (#33823)
* Change 'export default' to 'export ='

For packages that don't actually export a 'default' property.

* 7 more packages
2019-03-12 16:36:10 -07:00

45 lines
844 B
TypeScript

import Complex = require('complex');
let z: Complex = new Complex(2, 3);
z = Complex.from(2, 3);
z = Complex.from(2, 4);
z = Complex.from(5);
z = Complex.from('2+5i');
z = Complex.fromPolar(3, Math.PI);
z = Complex.i;
z = Complex.one;
z = z.fromRect(2, 3);
z = z.fromPolar(3, Math.PI);
z = z.toPrecision(3);
z = z.toFixed(3);
z = z.finalize();
let x: number = z.magnitude();
x = z.abs();
x = z.angle();
x = z.arg();
x = z.phase();
z = z.conjugate();
z = z.negate();
z = z.multiply(z);
z = z.mult(3);
z = z.divide(z);
z = z.div(3);
z = z.add(z);
z = z.subtract(z);
z = z.sub(3);
z = z.pow(z);
z = z.sqrt();
z = z.log(2);
z = z.exp();
z = z.sin();
z = z.cos();
z = z.tan();
z = z.sinh();
z = z.cosh();
z = z.tanh();
z = z.clone();
const s: string = z.toString();
const b: boolean = z.equals(z);
const n: number = z.real;
const i: number = z.im;