feat:node-modules

This commit is contained in:
houjunxiang
2025-11-24 10:26:18 +08:00
parent 753766893b
commit 8a3e48d856
8825 changed files with 567399 additions and 1 deletions

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAcos = void 0;
var _factory = require("../../utils/factory.js");
const name = 'acos';
const dependencies = ['typed', 'config', 'Complex'];
const createAcos = exports.createAcos = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex
} = _ref;
/**
* Calculate the inverse cosine of a value.
*
* To avoid confusion with the matrix arccosine, this function does not
* apply to matrices.
*
* Syntax:
*
* math.acos(x)
*
* Examples:
*
* math.acos(0.5) // returns number 1.0471975511965979
* math.acos(math.cos(1.5)) // returns number 1.5
*
* math.acos(2) // returns Complex 0 + 1.3169578969248166 i
*
* See also:
*
* cos, atan, asin
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} The arc cosine of x
*/
return typed(name, {
number: function (x) {
if (x >= -1 && x <= 1 || config.predictable) {
return Math.acos(x);
} else {
return new Complex(x, 0).acos();
}
},
Complex: function (x) {
return x.acos();
},
BigNumber: function (x) {
return x.acos();
}
});
});

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAcosh = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'acosh';
const dependencies = ['typed', 'config', 'Complex'];
const createAcosh = exports.createAcosh = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex
} = _ref;
/**
* Calculate the hyperbolic arccos of a value,
* defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.
*
* For matrices, the function is evaluated element wise.
*
* Syntax:
*
* math.acosh(x)
*
* Examples:
*
* math.acosh(1.5) // returns 0.9624236501192069
*
* See also:
*
* cosh, asinh, atanh
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic arccosine of x
*/
return typed(name, {
number: function (x) {
if (x >= 1 || config.predictable) {
return (0, _index.acoshNumber)(x);
}
if (x <= -1) {
return new Complex(Math.log(Math.sqrt(x * x - 1) - x), Math.PI);
}
return new Complex(x, 0).acosh();
},
Complex: function (x) {
return x.acosh();
},
BigNumber: function (x) {
return x.acosh();
}
});
});

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAcot = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'acot';
const dependencies = ['typed', 'BigNumber'];
const createAcot = exports.createAcot = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
/**
* Calculate the inverse cotangent of a value, defined as `acot(x) = atan(1/x)`.
*
* To avoid confusion with the matrix arccotanget, this function does not
* apply to matrices.
*
* Syntax:
*
* math.acot(x)
*
* Examples:
*
* math.acot(0.5) // returns number 1.1071487177940904
* math.acot(2) // returns number 0.4636476090008061
* math.acot(math.cot(1.5)) // returns number 1.5
*
* See also:
*
* cot, atan
*
* @param {number | BigNumber| Complex} x Function input
* @return {number | BigNumber| Complex} The arc cotangent of x
*/
return typed(name, {
number: _index.acotNumber,
Complex: function (x) {
return x.acot();
},
BigNumber: function (x) {
return new BigNumber(1).div(x).atan();
}
});
});

View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAcoth = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'acoth';
const dependencies = ['typed', 'config', 'Complex', 'BigNumber'];
const createAcoth = exports.createAcoth = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex,
BigNumber
} = _ref;
/**
* Calculate the inverse hyperbolic tangent of a value,
* defined as `acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.
*
* To avoid confusion with the matrix inverse hyperbolic tangent, this
* function does not apply to matrices.
*
* Syntax:
*
* math.acoth(x)
*
* Examples:
*
* math.acoth(0.5) // returns 0.8047189562170503
*
* See also:
*
* acsch, asech
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic arccotangent of x
*/
return typed(name, {
number: function (x) {
if (x >= 1 || x <= -1 || config.predictable) {
return (0, _index.acothNumber)(x);
}
return new Complex(x, 0).acoth();
},
Complex: function (x) {
return x.acoth();
},
BigNumber: function (x) {
return new BigNumber(1).div(x).atanh();
}
});
});

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAcsc = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'acsc';
const dependencies = ['typed', 'config', 'Complex', 'BigNumber'];
const createAcsc = exports.createAcsc = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex,
BigNumber
} = _ref;
/**
* Calculate the inverse cosecant of a value, defined as `acsc(x) = asin(1/x)`.
*
* To avoid confusion with the matrix arccosecant, this function does not
* apply to matrices.
*
* Syntax:
*
* math.acsc(x)
*
* Examples:
*
* math.acsc(2) // returns 0.5235987755982989
* math.acsc(0.5) // returns Complex 1.5707963267948966 -1.3169578969248166i
* math.acsc(math.csc(1.5)) // returns number ~1.5
*
* See also:
*
* csc, asin, asec
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} The arc cosecant of x
*/
return typed(name, {
number: function (x) {
if (x <= -1 || x >= 1 || config.predictable) {
return (0, _index.acscNumber)(x);
}
return new Complex(x, 0).acsc();
},
Complex: function (x) {
return x.acsc();
},
BigNumber: function (x) {
return new BigNumber(1).div(x).asin();
}
});
});

View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAcsch = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'acsch';
const dependencies = ['typed', 'BigNumber'];
const createAcsch = exports.createAcsch = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
/**
* Calculate the inverse hyperbolic cosecant of a value,
* defined as `acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1))`.
*
* To avoid confusion with the matrix inverse hyperbolic cosecant, this function
* does not apply to matrices.
*
* Syntax:
*
* math.acsch(x)
*
* Examples:
*
* math.acsch(0.5) // returns 1.4436354751788103
*
* See also:
*
* asech, acoth
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic arccosecant of x
*/
return typed(name, {
number: _index.acschNumber,
Complex: function (x) {
return x.acsch();
},
BigNumber: function (x) {
return new BigNumber(1).div(x).asinh();
}
});
});

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAsec = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'asec';
const dependencies = ['typed', 'config', 'Complex', 'BigNumber'];
const createAsec = exports.createAsec = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex,
BigNumber
} = _ref;
/**
* Calculate the inverse secant of a value. Defined as `asec(x) = acos(1/x)`.
*
* To avoid confusion with the matrix arcsecant, this function does not
* apply to matrices.
*
* Syntax:
*
* math.asec(x)
*
* Examples:
*
* math.asec(2) // returns 1.0471975511965979
* math.asec(math.sec(1.5)) // returns 1.5
*
* math.asec(0.5) // returns Complex 0 + 1.3169578969248166i
*
* See also:
*
* acos, acot, acsc
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} The arc secant of x
*/
return typed(name, {
number: function (x) {
if (x <= -1 || x >= 1 || config.predictable) {
return (0, _index.asecNumber)(x);
}
return new Complex(x, 0).asec();
},
Complex: function (x) {
return x.asec();
},
BigNumber: function (x) {
return new BigNumber(1).div(x).acos();
}
});
});

View File

@@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAsech = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'asech';
const dependencies = ['typed', 'config', 'Complex', 'BigNumber'];
const createAsech = exports.createAsech = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex,
BigNumber
} = _ref;
/**
* Calculate the hyperbolic arcsecant of a value,
* defined as `asech(x) = acosh(1/x) = ln(sqrt(1/x^2 - 1) + 1/x)`.
*
* To avoid confusion with the matrix hyperbolic arcsecant, this function
* does not apply to matrices.
*
* Syntax:
*
* math.asech(x)
*
* Examples:
*
* math.asech(0.5) // returns 1.3169578969248166
*
* See also:
*
* acsch, acoth
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic arcsecant of x
*/
return typed(name, {
number: function (x) {
if (x <= 1 && x >= -1 || config.predictable) {
const xInv = 1 / x;
if (xInv > 0 || config.predictable) {
return (0, _index.asechNumber)(x);
}
const ret = Math.sqrt(xInv * xInv - 1);
return new Complex(Math.log(ret - xInv), Math.PI);
}
return new Complex(x, 0).asech();
},
Complex: function (x) {
return x.asech();
},
BigNumber: function (x) {
return new BigNumber(1).div(x).acosh();
}
});
});

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAsin = void 0;
var _factory = require("../../utils/factory.js");
const name = 'asin';
const dependencies = ['typed', 'config', 'Complex'];
const createAsin = exports.createAsin = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex
} = _ref;
/**
* Calculate the inverse sine of a value.
*
* To avoid confusion with the matric arcsine, this function does not apply
* to matrices.
*
* Syntax:
*
* math.asin(x)
*
* Examples:
*
* math.asin(0.5) // returns number 0.5235987755982989
* math.asin(math.sin(1.5)) // returns number ~1.5
*
* math.asin(2) // returns Complex 1.5707963267948966 -1.3169578969248166i
*
* See also:
*
* sin, atan, acos
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} The arc sine of x
*/
return typed(name, {
number: function (x) {
if (x >= -1 && x <= 1 || config.predictable) {
return Math.asin(x);
} else {
return new Complex(x, 0).asin();
}
},
Complex: function (x) {
return x.asin();
},
BigNumber: function (x) {
return x.asin();
}
});
});

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAsinh = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'asinh';
const dependencies = ['typed'];
const createAsinh = exports.createAsinh = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Calculate the hyperbolic arcsine of a value,
* defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.
*
* To avoid confusion with the matrix hyperbolic arcsine, this function
* does not apply to matrices.
*
* Syntax:
*
* math.asinh(x)
*
* Examples:
*
* math.asinh(0.5) // returns 0.48121182505960347
*
* See also:
*
* acosh, atanh
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic arcsine of x
*/
return typed('asinh', {
number: _index.asinhNumber,
Complex: function (x) {
return x.asinh();
},
BigNumber: function (x) {
return x.asinh();
}
});
});

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAtan = void 0;
var _factory = require("../../utils/factory.js");
const name = 'atan';
const dependencies = ['typed'];
const createAtan = exports.createAtan = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Calculate the inverse tangent of a value.
*
* To avoid confusion with matrix arctangent, this function does not apply
* to matrices.
*
* Syntax:
*
* math.atan(x)
*
* Examples:
*
* math.atan(0.5) // returns number 0.4636476090008061
* math.atan(2) // returns number 1.1071487177940904
* math.atan(math.tan(1.5)) // returns number 1.5
*
* See also:
*
* tan, asin, acos
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} The arc tangent of x
*/
return typed('atan', {
number: function (x) {
return Math.atan(x);
},
Complex: function (x) {
return x.atan();
},
BigNumber: function (x) {
return x.atan();
}
});
});

View File

@@ -0,0 +1,95 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAtan2 = void 0;
var _factory = require("../../utils/factory.js");
var _matAlgo02xDS = require("../../type/matrix/utils/matAlgo02xDS0.js");
var _matAlgo03xDSf = require("../../type/matrix/utils/matAlgo03xDSf.js");
var _matAlgo09xS0Sf = require("../../type/matrix/utils/matAlgo09xS0Sf.js");
var _matAlgo11xS0s = require("../../type/matrix/utils/matAlgo11xS0s.js");
var _matAlgo12xSfs = require("../../type/matrix/utils/matAlgo12xSfs.js");
var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js");
const name = 'atan2';
const dependencies = ['typed', 'matrix', 'equalScalar', 'BigNumber', 'DenseMatrix', 'concat'];
const createAtan2 = exports.createAtan2 = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
matrix,
equalScalar,
BigNumber,
DenseMatrix,
concat
} = _ref;
const matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({
typed,
equalScalar
});
const matAlgo03xDSf = (0, _matAlgo03xDSf.createMatAlgo03xDSf)({
typed
});
const matAlgo09xS0Sf = (0, _matAlgo09xS0Sf.createMatAlgo09xS0Sf)({
typed,
equalScalar
});
const matAlgo11xS0s = (0, _matAlgo11xS0s.createMatAlgo11xS0s)({
typed,
equalScalar
});
const matAlgo12xSfs = (0, _matAlgo12xSfs.createMatAlgo12xSfs)({
typed,
DenseMatrix
});
const matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({
typed,
matrix,
concat
});
/**
* Calculate the inverse tangent function with two arguments, y/x.
* By providing two arguments, the right quadrant of the computed angle can be
* determined.
*
* For matrices, the function is evaluated element wise.
*
* Syntax:
*
* math.atan2(y, x)
*
* Examples:
*
* math.atan2(2, 2) / math.pi // returns number 0.25
*
* const angle = math.unit(60, 'deg') // returns Unit 60 deg
* const x = math.cos(angle)
* const y = math.sin(angle)
*
* math.atan(2) // returns number 1.1071487177940904
*
* See also:
*
* tan, atan, sin, cos
*
* @param {number | Array | Matrix} y Second dimension
* @param {number | Array | Matrix} x First dimension
* @return {number | Array | Matrix} Four-quadrant inverse tangent
*/
return typed(name, {
'number, number': Math.atan2,
// Complex numbers doesn't seem to have a reasonable implementation of
// atan2(). Even Matlab removed the support, after they only calculated
// the atan only on base of the real part of the numbers and ignored
// the imaginary.
'BigNumber, BigNumber': (y, x) => BigNumber.atan2(y, x)
}, matrixAlgorithmSuite({
scalar: 'number | BigNumber',
SS: matAlgo09xS0Sf,
DS: matAlgo03xDSf,
SD: matAlgo02xDS0,
Ss: matAlgo11xS0s,
sS: matAlgo12xSfs
}));
});

View File

@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAtanh = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'atanh';
const dependencies = ['typed', 'config', 'Complex'];
const createAtanh = exports.createAtanh = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config,
Complex
} = _ref;
/**
* Calculate the hyperbolic arctangent of a value,
* defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.
*
* To avoid confusion with the matrix hyperbolic arctangent, this function
* does not apply to matrices.
*
* Syntax:
*
* math.atanh(x)
*
* Examples:
*
* math.atanh(0.5) // returns 0.5493061443340549
*
* See also:
*
* acosh, asinh
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic arctangent of x
*/
return typed(name, {
number: function (x) {
if (x <= 1 && x >= -1 || config.predictable) {
return (0, _index.atanhNumber)(x);
}
return new Complex(x, 0).atanh();
},
Complex: function (x) {
return x.atanh();
},
BigNumber: function (x) {
return x.atanh();
}
});
});

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCos = void 0;
var _factory = require("../../utils/factory.js");
var _trigUnit = require("./trigUnit.js");
const name = 'cos';
const dependencies = ['typed'];
const createCos = exports.createCos = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
const trigUnit = (0, _trigUnit.createTrigUnit)({
typed
});
/**
* Calculate the cosine of a value.
*
* To avoid confusion with the matrix cosine, this function does not
* apply to matrices.
*
* Syntax:
*
* math.cos(x)
*
* Examples:
*
* math.cos(2) // returns number -0.4161468365471422
* math.cos(math.pi / 4) // returns number 0.7071067811865475
* math.cos(math.unit(180, 'deg')) // returns number -1
* math.cos(math.unit(60, 'deg')) // returns number 0.5
*
* const angle = 0.2
* math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number ~1
*
* See also:
*
* cos, tan
*
* @param {number | BigNumber | Complex | Unit} x Function input
* @return {number | BigNumber | Complex} Cosine of x
*/
return typed(name, {
number: Math.cos,
'Complex | BigNumber': x => x.cos()
}, trigUnit);
});

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCosh = void 0;
var _factory = require("../../utils/factory.js");
var _number = require("../../utils/number.js");
const name = 'cosh';
const dependencies = ['typed'];
const createCosh = exports.createCosh = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Calculate the hyperbolic cosine of a value,
* defined as `cosh(x) = 1/2 * (exp(x) + exp(-x))`.
*
* To avoid confusion with the matrix hyperbolic cosine, this function does
* not apply to matrices.
*
* Syntax:
*
* math.cosh(x)
*
* Examples:
*
* math.cosh(0.5) // returns number 1.1276259652063807
*
* See also:
*
* sinh, tanh
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic cosine of x
*/
return typed(name, {
number: _number.cosh,
'Complex | BigNumber': x => x.cosh()
});
});

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCot = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
var _trigUnit = require("./trigUnit.js");
const name = 'cot';
const dependencies = ['typed', 'BigNumber'];
const createCot = exports.createCot = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
const trigUnit = (0, _trigUnit.createTrigUnit)({
typed
});
/**
* Calculate the cotangent of a value. Defined as `cot(x) = 1 / tan(x)`.
*
* To avoid confusion with the matrix cotangent, this function does not
* apply to matrices.
*
* Syntax:
*
* math.cot(x)
*
* Examples:
*
* math.cot(2) // returns number -0.45765755436028577
* 1 / math.tan(2) // returns number -0.45765755436028577
*
* See also:
*
* tan, sec, csc
*
* @param {number | Complex | Unit | Array | Matrix} x Function input
* @return {number | Complex | Array | Matrix} Cotangent of x
*/
return typed(name, {
number: _index.cotNumber,
Complex: x => x.cot(),
BigNumber: x => new BigNumber(1).div(x.tan())
}, trigUnit);
});

View File

@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCoth = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'coth';
const dependencies = ['typed', 'BigNumber'];
const createCoth = exports.createCoth = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
/**
* Calculate the hyperbolic cotangent of a value,
* defined as `coth(x) = 1 / tanh(x)`.
*
* To avoid confusion with the matrix hyperbolic cotangent, this function
* does not apply to matrices.
*
* Syntax:
*
* math.coth(x)
*
* Examples:
*
* // coth(x) = 1 / tanh(x)
* math.coth(2) // returns 1.0373147207275482
* 1 / math.tanh(2) // returns 1.0373147207275482
*
* See also:
*
* sinh, tanh, cosh
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic cotangent of x
*/
return typed(name, {
number: _index.cothNumber,
Complex: x => x.coth(),
BigNumber: x => new BigNumber(1).div(x.tanh())
});
});

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCsc = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
var _trigUnit = require("./trigUnit.js");
const name = 'csc';
const dependencies = ['typed', 'BigNumber'];
const createCsc = exports.createCsc = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
const trigUnit = (0, _trigUnit.createTrigUnit)({
typed
});
/**
* Calculate the cosecant of a value, defined as `csc(x) = 1/sin(x)`.
*
* To avoid confusion with the matrix cosecant, this function does not
* apply to matrices.
*
* Syntax:
*
* math.csc(x)
*
* Examples:
*
* math.csc(2) // returns number 1.099750170294617
* 1 / math.sin(2) // returns number 1.099750170294617
*
* See also:
*
* sin, sec, cot
*
* @param {number | BigNumber | Complex | Unit} x Function input
* @return {number | BigNumber | Complex} Cosecant of x
*/
return typed(name, {
number: _index.cscNumber,
Complex: x => x.csc(),
BigNumber: x => new BigNumber(1).div(x.sin())
}, trigUnit);
});

View File

@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCsch = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'csch';
const dependencies = ['typed', 'BigNumber'];
const createCsch = exports.createCsch = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
/**
* Calculate the hyperbolic cosecant of a value,
* defined as `csch(x) = 1 / sinh(x)`.
*
* To avoid confusion with the matrix hyperbolic cosecant, this function
* does not apply to matrices.
*
* Syntax:
*
* math.csch(x)
*
* Examples:
*
* // csch(x) = 1/ sinh(x)
* math.csch(0.5) // returns 1.9190347513349437
* 1 / math.sinh(0.5) // returns 1.9190347513349437
*
* See also:
*
* sinh, sech, coth
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic cosecant of x
*/
return typed(name, {
number: _index.cschNumber,
Complex: x => x.csch(),
BigNumber: x => new BigNumber(1).div(x.sinh())
});
});

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSec = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
var _trigUnit = require("./trigUnit.js");
const name = 'sec';
const dependencies = ['typed', 'BigNumber'];
const createSec = exports.createSec = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
const trigUnit = (0, _trigUnit.createTrigUnit)({
typed
});
/**
* Calculate the secant of a value, defined as `sec(x) = 1/cos(x)`.
*
* To avoid confusion with the matrix secant, this function does not
* apply to matrices.
*
* Syntax:
*
* math.sec(x)
*
* Examples:
*
* math.sec(2) // returns number -2.4029979617223822
* 1 / math.cos(2) // returns number -2.4029979617223822
*
* See also:
*
* cos, csc, cot
*
* @param {number | BigNumber | Complex | Unit} x Function input
* @return {number | BigNumber | Complex} Secant of x
*/
return typed(name, {
number: _index.secNumber,
Complex: x => x.sec(),
BigNumber: x => new BigNumber(1).div(x.cos())
}, trigUnit);
});

View File

@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSech = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'sech';
const dependencies = ['typed', 'BigNumber'];
const createSech = exports.createSech = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
BigNumber
} = _ref;
/**
* Calculate the hyperbolic secant of a value,
* defined as `sech(x) = 1 / cosh(x)`.
*
* To avoid confusion with the matrix hyperbolic secant, this function does
* not apply to matrices.
*
* Syntax:
*
* math.sech(x)
*
* Examples:
*
* // sech(x) = 1/ cosh(x)
* math.sech(0.5) // returns 0.886818883970074
* 1 / math.cosh(0.5) // returns 0.886818883970074
*
* See also:
*
* cosh, csch, coth
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic secant of x
*/
return typed(name, {
number: _index.sechNumber,
Complex: x => x.sech(),
BigNumber: x => new BigNumber(1).div(x.cosh())
});
});

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSin = void 0;
var _factory = require("../../utils/factory.js");
var _trigUnit = require("./trigUnit.js");
const name = 'sin';
const dependencies = ['typed'];
const createSin = exports.createSin = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
const trigUnit = (0, _trigUnit.createTrigUnit)({
typed
});
/**
* Calculate the sine of a value.
*
* To avoid confusion with the matrix sine, this function does not apply
* to matrices.
*
* Syntax:
*
* math.sin(x)
*
* Examples:
*
* math.sin(2) // returns number 0.9092974268256813
* math.sin(math.pi / 4) // returns number 0.7071067811865475
* math.sin(math.unit(90, 'deg')) // returns number 1
* math.sin(math.unit(30, 'deg')) // returns number 0.5
*
* const angle = 0.2
* math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number ~1
*
* See also:
*
* cos, tan
*
* @param {number | BigNumber | Complex | Unit} x Function input
* @return {number | BigNumber | Complex} Sine of x
*/
return typed(name, {
number: Math.sin,
'Complex | BigNumber': x => x.sin()
}, trigUnit);
});

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSinh = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'sinh';
const dependencies = ['typed'];
const createSinh = exports.createSinh = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Calculate the hyperbolic sine of a value,
* defined as `sinh(x) = 1/2 * (exp(x) - exp(-x))`.
*
* To avoid confusion with the matrix hyperbolic sine, this function does
* not apply to matrices.
*
* Syntax:
*
* math.sinh(x)
*
* Examples:
*
* math.sinh(0.5) // returns number 0.5210953054937474
*
* See also:
*
* cosh, tanh
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic sine of x
*/
return typed(name, {
number: _index.sinhNumber,
'Complex | BigNumber': x => x.sinh()
});
});

View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createTan = void 0;
var _factory = require("../../utils/factory.js");
var _trigUnit = require("./trigUnit.js");
const name = 'tan';
const dependencies = ['typed'];
const createTan = exports.createTan = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
const trigUnit = (0, _trigUnit.createTrigUnit)({
typed
});
/**
* Calculate the tangent of a value. `tan(x)` is equal to `sin(x) / cos(x)`.
*
* To avoid confusion with the matrix tangent, this function does not apply
* to matrices.
*
* Syntax:
*
* math.tan(x)
*
* Examples:
*
* math.tan(0.5) // returns number 0.5463024898437905
* math.sin(0.5) / math.cos(0.5) // returns number 0.5463024898437905
* math.tan(math.pi / 4) // returns number 1
* math.tan(math.unit(45, 'deg')) // returns number 1
*
* See also:
*
* atan, sin, cos
*
* @param {number | BigNumber | Complex | Unit} x Function input
* @return {number | BigNumber | Complex} Tangent of x
*/
return typed(name, {
number: Math.tan,
'Complex | BigNumber': x => x.tan()
}, trigUnit);
});

View File

@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createTanh = void 0;
var _factory = require("../../utils/factory.js");
var _number = require("../../utils/number.js");
const name = 'tanh';
const dependencies = ['typed'];
const createTanh = exports.createTanh = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Calculate the hyperbolic tangent of a value,
* defined as `tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1)`.
*
* To avoid confusion with matrix hyperbolic tangent, this function does
* not apply to matrices.
*
* Syntax:
*
* math.tanh(x)
*
* Examples:
*
* // tanh(x) = sinh(x) / cosh(x) = 1 / coth(x)
* math.tanh(0.5) // returns 0.46211715726000974
* math.sinh(0.5) / math.cosh(0.5) // returns 0.46211715726000974
* 1 / math.coth(0.5) // returns 0.46211715726000974
*
* See also:
*
* sinh, cosh, coth
*
* @param {number | BigNumber | Complex} x Function input
* @return {number | BigNumber | Complex} Hyperbolic tangent of x
*/
return typed('tanh', {
number: _number.tanh,
'Complex | BigNumber': x => x.tanh()
});
});

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createTrigUnit = void 0;
var _factory = require("../../utils/factory.js");
const createTrigUnit = exports.createTrigUnit = /* #__PURE__ */(0, _factory.factory)('trigUnit', ['typed'], _ref => {
let {
typed
} = _ref;
return {
Unit: typed.referToSelf(self => x => {
if (!x.hasBase(x.constructor.BASE_UNITS.ANGLE)) {
throw new TypeError('Unit in function cot is no angle');
}
return typed.find(self, x.valueType())(x.value);
})
};
});