UNPKG

complex-js

Version:
92 lines 3.63 kB
declare class Complex { get real(): number; get imag(): number; get abs(): number; get arg(): number; get norm(): number; add(this: Complex, z: Complex): Complex; sub(this: Complex, z: Complex): Complex; mul(this: Complex, z: Complex): Complex; div(this: Complex, z: Complex): Complex; mod(this: Complex, z: Complex): Complex; pow(this: Complex, z: Complex): Complex; toString(this: Complex): string; } interface BinaryExpression<T = number> { type: "BinaryExpression"; operator: "+" | "-" | "*" | "/" | "%" | "**"; left: Expression<T>; right: Expression<T>; } interface CallExpression<T = number> { type: "CallExpression"; callee: Identifier; arguments: Expression<T>[]; } type Expression<T = number> = BinaryExpression<T> | CallExpression<T> | UnaryExpression<T> | Identifier | Literal<T>; interface Identifier { type: "Identifier"; name: string; } interface Literal<T = number> { type: "Literal"; value: T; } interface UnaryExpression<T = number> { type: "UnaryExpression"; operator: "+" | "-"; argument: Expression<T>; } declare const parse: (expression: string) => Expression; declare const E: Complex; declare const I: Complex; declare const LN10: Complex; declare const LN2: Complex; declare const LOG10E: Complex; declare const LOG2E: Complex; declare const PI: Complex; declare const SQRT1_2: Complex; declare const SQRT2: Complex; declare const acos: (z: Complex) => Complex; declare const acosh: (z: Complex) => Complex; declare const add: (lhs: Complex, rhs: Complex) => Complex; declare const asin: (z: Complex) => Complex; declare const asinh: (z: Complex) => Complex; declare const atan: (z: Complex) => Complex; declare const atanh: (z: Complex) => Complex; declare const cartesian: (real: number, imag: number) => Complex; declare const cbrt: (z: Complex) => Complex; declare const conj: (z: Complex) => Complex; declare const cos: (z: Complex) => Complex; declare const cosh: (z: Complex) => Complex; declare const div: (lhs: Complex, rhs: Complex) => Complex; declare const exp: (z: Complex) => Complex; declare const from: { (z: Complex): Complex; (real: number, imag?: number): Complex; (...args: [ z: Complex ] | [ real: number, imag?: number ]): Complex; }; declare const log: (z: Complex) => Complex; declare const mod: (lhs: Complex, rhs: Complex) => Complex; declare const mul: (lhs: Complex, rhs: Complex) => Complex; declare const polar: (abs: number, arg: number) => Complex; declare const pow: (lhs: Complex, rhs: Complex) => Complex; declare const proj: (z: Complex) => Complex; declare const sin: (z: Complex) => Complex; declare const sinh: (z: Complex) => Complex; declare const sqrt: (z: Complex) => Complex; declare const sub: (lhs: Complex, rhs: Complex) => Complex; declare const tan: (z: Complex) => Complex; declare const tanh: (z: Complex) => Complex; declare const trunc: (z: Complex) => Complex; type Value = Complex | ((...args: Complex[]) => Complex); type Bindings = Record<string, Value>; declare const bindings: Bindings; declare const compile: (expression: string, constants?: Bindings) => (variables?: Bindings | undefined) => Value; export { E, I, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2, BinaryExpression, CallExpression, Expression, Identifier, Literal, UnaryExpression, acos, acosh, add, asin, asinh, atan, atanh, cartesian, cbrt, conj, cos, cosh, div, exp, from, log, mod, mul, polar, pow, proj, sin, sinh, sqrt, sub, tan, tanh, trunc, Bindings, Value, bindings, compile, Complex, parse }; //# sourceMappingURL=complex.d.ts.map