mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Added type defs for complex.js
This commit is contained in:
parent
b1285dace3
commit
1293fcfe4c
61
types/complex.js/complex.js-tests.ts
Normal file
61
types/complex.js/complex.js-tests.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import Complex from "complex.js";
|
||||
|
||||
Complex.ZERO;
|
||||
Complex.PI;
|
||||
Complex.E;
|
||||
Complex.I;
|
||||
Complex.INFINITY;
|
||||
Complex.EPSILON;
|
||||
Complex.ONE;
|
||||
Complex.NAN;
|
||||
|
||||
new Complex(1, 0);
|
||||
new Complex(1, 0).abs();
|
||||
new Complex(1, 0).acos();
|
||||
new Complex(1, 0).acot();
|
||||
new Complex(1, 0).acoth();
|
||||
new Complex(1, 0).acsc();
|
||||
new Complex(1, 0).acsch();
|
||||
new Complex(1, 0).add(1, 2);
|
||||
new Complex(1, 0).arg();
|
||||
new Complex(1, 0).asec();
|
||||
new Complex(1, 0).asech();
|
||||
new Complex(1, 0).asin();
|
||||
new Complex(1, 0).asinh();
|
||||
new Complex(1, 0).atan();
|
||||
new Complex(1, 0).atanh();
|
||||
new Complex(1, 0).ceil(5);
|
||||
new Complex(1, 0).clone();
|
||||
new Complex(1, 0).conjugate();
|
||||
new Complex(1, 0).cos();
|
||||
new Complex(1, 0).cosh();
|
||||
new Complex(1, 0).cot();
|
||||
new Complex(1, 0).coth();
|
||||
new Complex(1, 0).csc();
|
||||
new Complex(1, 0).csch();
|
||||
new Complex(1, 0).div(3, 1);
|
||||
new Complex(1, 0).equals(5, 3);
|
||||
new Complex(1, 0).exp();
|
||||
new Complex(1, 0).floor(6);
|
||||
new Complex(1, 0).inverse();
|
||||
new Complex(1, 0).isFinite();
|
||||
new Complex(1, 0).isInfinite();
|
||||
new Complex(1, 0).isNaN();
|
||||
new Complex(1, 0).isZero();
|
||||
new Complex(1, 0).log();
|
||||
new Complex(1, 0).mul(3, 1);
|
||||
new Complex(1, 0).neg();
|
||||
new Complex(1, 0).pow(1, 2);
|
||||
new Complex(1, 0).round(3);
|
||||
new Complex(1, 0).sec();
|
||||
new Complex(1, 0).sech();
|
||||
new Complex(1, 0).sign();
|
||||
new Complex(1, 0).sin();
|
||||
new Complex(1, 0).sinh();
|
||||
new Complex(1, 0).sqrt();
|
||||
new Complex(1, 0).sub(5, 1);
|
||||
new Complex(1, 0).tan();
|
||||
new Complex(1, 0).tanh();
|
||||
new Complex(1, 0).toString();
|
||||
new Complex(1, 0).toVector();
|
||||
new Complex(1, 0).valueOf();
|
||||
304
types/complex.js/index.d.ts
vendored
Normal file
304
types/complex.js/index.d.ts
vendored
Normal file
@ -0,0 +1,304 @@
|
||||
// Type definitions for complex.js 2.0
|
||||
// Project: https://github.com/infusion/Complex.js
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Complex {
|
||||
/**
|
||||
* A complex zero value (south pole on the Riemann Sphere).
|
||||
*/
|
||||
static ZERO: Complex;
|
||||
|
||||
/**
|
||||
* A complex one instance.
|
||||
*/
|
||||
static ONE: Complex;
|
||||
|
||||
/**
|
||||
* A complex infinity value (north pole on the Riemann Sphere).
|
||||
*/
|
||||
static INFINITY: Complex;
|
||||
|
||||
/**
|
||||
* A complex NaN value (not on the Riemann Sphere).
|
||||
*/
|
||||
static NAN: Complex;
|
||||
|
||||
/**
|
||||
* An imaginary number i instance.
|
||||
*/
|
||||
static I: Complex;
|
||||
|
||||
/**
|
||||
* A complex PI instance.
|
||||
*/
|
||||
static PI: Complex;
|
||||
|
||||
/**
|
||||
* A complex euler number instance.
|
||||
*/
|
||||
static E: Complex;
|
||||
|
||||
/**
|
||||
* A small epsilon value used for equals() comparison in order to circumvent double inprecision.
|
||||
*/
|
||||
static EPSILON: number;
|
||||
|
||||
constructor(x: number, y: number);
|
||||
|
||||
/**
|
||||
* Returns the complex sign, defined as the complex number
|
||||
* normalized by it's absolute value.
|
||||
*/
|
||||
sign(): Complex;
|
||||
|
||||
/**
|
||||
* Adds another complex number.
|
||||
*/
|
||||
add(a: number, b: number): Complex;
|
||||
|
||||
/**
|
||||
* Subtracts another complex number.
|
||||
*/
|
||||
sub(a: number, b: number): Complex;
|
||||
|
||||
/**
|
||||
* Multiplies the number with another complex number.
|
||||
*/
|
||||
mul(a: number, b: number): Complex;
|
||||
|
||||
/**
|
||||
* Divides the number by another complex number.
|
||||
*/
|
||||
div(a: number, b: number): Complex;
|
||||
|
||||
/**
|
||||
* Returns the number raised to the complex exponent.
|
||||
*/
|
||||
pow(a: number, b: number): Complex;
|
||||
|
||||
/**
|
||||
* Returns the complex square root of the number.
|
||||
*/
|
||||
sqrt(): Complex;
|
||||
|
||||
/**
|
||||
* Returns e^n with complex exponent n
|
||||
*/
|
||||
exp(): Complex;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm (base E) of the actual complex number.
|
||||
*/
|
||||
log(): Complex;
|
||||
|
||||
/**
|
||||
* Calculates the magnitude of the complex number.
|
||||
*/
|
||||
abs(): number;
|
||||
|
||||
/**
|
||||
* Calculate the angle of the complex number.
|
||||
*/
|
||||
arg(): number;
|
||||
|
||||
/**
|
||||
* Calculates the multiplicative inverse of the complex number (1 / z).
|
||||
*/
|
||||
inverse(): Complex;
|
||||
|
||||
/**
|
||||
* Calculates the conjugate of the complex number (multiplies the imaginary part with -1).
|
||||
*/
|
||||
conjugate(): Complex;
|
||||
|
||||
/**
|
||||
* Negates the number (multiplies both the real and imaginary part with -1) in order to get the additive inverse.
|
||||
*/
|
||||
neg(): Complex;
|
||||
|
||||
/**
|
||||
* Floors the complex number parts towards zero.
|
||||
*/
|
||||
floor(places: number): Complex;
|
||||
|
||||
/**
|
||||
* Ceils the complex number parts off zero.
|
||||
*/
|
||||
ceil(places: number): Complex;
|
||||
|
||||
/**
|
||||
* Rounds the complex number parts.
|
||||
*/
|
||||
round(places: number): Complex;
|
||||
|
||||
/**
|
||||
* Checks if both numbers are exactly the same,
|
||||
* if both numbers are infinite they are considered not equal.
|
||||
*/
|
||||
equals(a: number, b: number): boolean;
|
||||
|
||||
/**
|
||||
* Checks if the given number is not a number.
|
||||
*/
|
||||
isNaN(): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether or not a complex number is at the zero pole of the
|
||||
* Riemann sphere.
|
||||
*/
|
||||
isZero(): boolean;
|
||||
|
||||
/**
|
||||
* Checks if the given number is finite.
|
||||
*/
|
||||
isFinite(): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether or not a complex number is at the infinity pole of the
|
||||
* Riemann sphere.
|
||||
*/
|
||||
isInfinite(): boolean;
|
||||
|
||||
/**
|
||||
* Returns a new Complex instance with the same real and imaginary properties.
|
||||
*/
|
||||
clone(): Complex;
|
||||
|
||||
/**
|
||||
* Returns a Vector of the actual complex number with two components.
|
||||
*/
|
||||
toVector(): number[];
|
||||
|
||||
/**
|
||||
* Returns a string representation of the actual number. As of v1.9.0 the output is a bit more human readable.
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Returns the real part of the number if imaginary part is zero. Otherwise null.
|
||||
*/
|
||||
valueOf(): number|undefined;
|
||||
|
||||
/**
|
||||
* Calculate the sine of the complex number.
|
||||
*/
|
||||
sin(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex arcus sinus.
|
||||
*/
|
||||
asin(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex sinh.
|
||||
*/
|
||||
sinh(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex asinh.
|
||||
*/
|
||||
asinh(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the cosine.
|
||||
*/
|
||||
cos(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex arcus cosinus.
|
||||
*/
|
||||
acos(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex cosh.
|
||||
*/
|
||||
cosh(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex asinh.
|
||||
*/
|
||||
acosh(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the tangent.
|
||||
*/
|
||||
tan(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex arcus tangent.
|
||||
*/
|
||||
atan(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex tanh.
|
||||
*/
|
||||
tanh(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex atanh.
|
||||
*/
|
||||
atanh(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the cotangent.
|
||||
*/
|
||||
cot(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex arcus cotangent.
|
||||
*/
|
||||
acot(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex coth.
|
||||
*/
|
||||
coth(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex acoth.
|
||||
*/
|
||||
acoth(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the secant.
|
||||
*/
|
||||
sec(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex arcus secant.
|
||||
*/
|
||||
asec(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex sech.
|
||||
*/
|
||||
sech(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex asech.
|
||||
*/
|
||||
asech(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the cosecans.
|
||||
*/
|
||||
csc(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex arcus cosecans.
|
||||
*/
|
||||
acsc(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex csch.
|
||||
*/
|
||||
csch(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the complex acsch.
|
||||
*/
|
||||
acsch(): Complex;
|
||||
}
|
||||
|
||||
export default Complex;
|
||||
25
types/complex.js/tsconfig.json
Normal file
25
types/complex.js/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"complex.js-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/complex.js/tslint.json
Normal file
3
types/complex.js/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user