remove node_modules and .gitignore them

This commit is contained in:
2023-11-24 14:40:32 -05:00
parent 5f6e638903
commit a74d7b91b8
8963 changed files with 1 additions and 874175 deletions
-36
View File
@@ -1,36 +0,0 @@
/**
* Bessel function of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Bessel_functions_of_the_first_kind:_J.CE.B1
*/
export declare function cyl_bessel_j(n: number, x: number): number;
/**
* Bessel function of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Bessel_functions_of_the_second_kind:_Y.CE.B1
*/
export declare function cyl_neumann(v: number, x: number): number;
/**
* Spherical Bessel function of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Spherical_Bessel_functions:_jn.2C_yn
*/
export declare function sph_bessel(n: number, x: number): number;
/**
* Spherical Bessel function of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Spherical_Bessel_functions:_jn.2C_yn
*/
export declare function sph_neumann(n: number, x: number): number;
/**
* Modified cylindrical Bessel function of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Modified_Bessel_functions:_I.CE.B1_.2C_K.CE.B1
*/
export declare function cyl_bessel_i(n: number, x: number): number;
/**
* Modified cylindrical Bessel function of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Modified_Bessel_functions:_I.CE.B1_.2C_K.CE.B1
*/
export declare function cyl_bessel_k(n: number, x: number): number;
-141
View File
@@ -1,141 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cyl_bessel_k = exports.cyl_bessel_i = exports.sph_neumann = exports.sph_bessel = exports.cyl_neumann = exports.cyl_bessel_j = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var MathUtil_1 = require("../../internal/numeric/MathUtil");
var InvalidArgument_1 = require("../../exception/InvalidArgument");
var gamma_1 = require("./gamma");
var INFINITY = 100; // (1 / 30!) is nearby 0.
/*================================================================
ORIGINAL FUNCTIONS
- CYLINDRICAL
- SPHERICAL
==================================================================
FIRST KIND
--------------------------------------------------------------- */
/**
* Bessel function of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Bessel_functions_of_the_first_kind:_J.CE.B1
*/
function cyl_bessel_j(n, x) {
// VALIDATION
if (x < 0 && Math.floor(n) !== n)
throw new InvalidArgument_1.InvalidArgument("Error on std.cyl_bessel_j(): n must be integer when x is negative -> (n = ".concat(n, ", x = ").concat(x, ")."));
else if (x === 0 && n !== 0)
throw new InvalidArgument_1.InvalidArgument("Error on std.cyl_bessel_j(): n must be zero when x is zero -> (n = ".concat(n, ", x = ").concat(x, ")."));
// COMPUTATION
if (n === Math.floor(n))
return _J_int(n, x);
else
return _J_positive(n, x);
}
exports.cyl_bessel_j = cyl_bessel_j;
/**
* Bessel function of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Bessel_functions_of_the_second_kind:_Y.CE.B1
*/
function cyl_neumann(v, x) {
if (x <= 0)
throw new InvalidArgument_1.InvalidArgument("Error on std.cyl_neumann(): x must be greater than zero -> (x = ".concat(x, ")."));
var numerator = cyl_bessel_j(v, x) * Math.cos(v * Math.PI) - cyl_bessel_j(-v, x);
var denominator = Math.sin(v * Math.PI);
return numerator / denominator;
}
exports.cyl_neumann = cyl_neumann;
function _J_int(n, x) {
if (n < 0)
return Math.pow(-1, n) * _J_positive(-n, x);
else
return _J_positive(n, x);
}
function _J_positive(v, x) {
var sigma = MathUtil_1.MathUtil.sigma(function (k) {
var ret = Math.pow(-1, k) * Math.pow(x / 2, v + 2 * k);
ret /= MathUtil_1.MathUtil.factorial(k) * (0, gamma_1.tgamma)(v + k + 1);
return ret;
}, 0, INFINITY);
return sigma;
}
/* ---------------------------------------------------------------
SPHERICAL
--------------------------------------------------------------- */
/**
* Spherical Bessel function of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Spherical_Bessel_functions:_jn.2C_yn
*/
function sph_bessel(n, x) {
return Math.sqrt(Math.PI / (2 * x)) * cyl_bessel_j(n + 0.5, x);
}
exports.sph_bessel = sph_bessel;
/**
* Spherical Bessel function of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Spherical_Bessel_functions:_jn.2C_yn
*/
function sph_neumann(n, x) {
var ret = Math.sqrt(Math.PI / (2 * x));
ret *= cyl_neumann(n + 0.5, x);
return ret;
}
exports.sph_neumann = sph_neumann;
/*================================================================
REQGULAR MODIFIED
- FIRST KIND
- SECOND KIND
==================================================================
FIRST KIND
--------------------------------------------------------------- */
/**
* Modified cylindrical Bessel function of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Modified_Bessel_functions:_I.CE.B1_.2C_K.CE.B1
*/
function cyl_bessel_i(n, x) {
// VALIDATION
if (x < 0 && Math.floor(n) !== n)
throw new InvalidArgument_1.InvalidArgument("Error on std.cyl_bessel_i(): n must be integer when x is negative -> (n = ".concat(n, ", x = ").concat(x, ")."));
else if (x === 0 && n !== 0)
throw new InvalidArgument_1.InvalidArgument("Error on std.cyl_bessel_i(): n must be zero when x is zero -> (n = ".concat(n, ", x = ").concat(x, ")."));
// COMPUTATION
if (n === 0.5)
return Math.sqrt(2.0 / (Math.PI * x)) * Math.sinh(x);
else
return _Bessel_i(n, x);
}
exports.cyl_bessel_i = cyl_bessel_i;
function _Bessel_i(v, x) {
return MathUtil_1.MathUtil.sigma(function (k) {
var numerator = Math.pow(x / 2, v + 2 * k);
var denominator = MathUtil_1.MathUtil.factorial(k) * (0, gamma_1.tgamma)(v + k + 1);
return numerator / denominator;
}, 0, INFINITY);
}
/* ---------------------------------------------------------------
SECOND KIND
--------------------------------------------------------------- */
/**
* Modified cylindrical Bessel function of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Bessel_function#Modified_Bessel_functions:_I.CE.B1_.2C_K.CE.B1
*/
function cyl_bessel_k(n, x) {
if (x <= 0)
throw new InvalidArgument_1.InvalidArgument("Error on std.cyl_bessel_k(): requires x > 0 -> (x = ".concat(x, ")."));
return _Bessel_k(n, x);
}
exports.cyl_bessel_k = cyl_bessel_k;
function _Bessel_k(v, z) {
var ret = Math.PI / 2;
ret *= cyl_bessel_i(-v, z) - cyl_bessel_i(v, z);
ret /= Math.sin(v * Math.PI);
return ret;
}
//# sourceMappingURL=bessels.js.map
-6
View File
@@ -1,6 +0,0 @@
/**
* Beta function.
*
* @reference https://en.wikipedia.org/wiki/Beta_function
*/
export declare function beta(x: number, y: number): number;
-20
View File
@@ -1,20 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.beta = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var gamma_1 = require("./gamma");
/**
* Beta function.
*
* @reference https://en.wikipedia.org/wiki/Beta_function
*/
function beta(x, y) {
return ((0, gamma_1.tgamma)(x) * (0, gamma_1.tgamma)(y)) / (0, gamma_1.tgamma)(x + y);
}
exports.beta = beta;
//# sourceMappingURL=beta.js.map
-36
View File
@@ -1,36 +0,0 @@
/**
* Incomplete elliptic integral of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_first_kind
*/
export declare function ellint_1(k: number, phi: number): number;
/**
* Complete elliptic integral of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Elliptic_integral_of_the_first_kind
*/
export declare function comp_ellint_1(k: number): number;
/**
* Incomplete elliptic integral of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Incomplete_elliptic_integral_of_the_second_kind
*/
export declare function ellint_2(k: number, phi: number): number;
/**
* Complete elliptic integral of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_second_kind
*/
export declare function comp_ellint_2(k: number): number;
/**
* Incomplete elliptic integral of the 3rd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_third_kind
*/
export declare function ellint_3(k: number, v: number, phi: number): number;
/**
* Complete elliptic integral of the 3rd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Incomplete_elliptic_integral_of_the_third_kind
*/
export declare function comp_ellint_3(k: number, n: number): number;
-106
View File
@@ -1,106 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.comp_ellint_3 = exports.ellint_3 = exports.comp_ellint_2 = exports.ellint_2 = exports.comp_ellint_1 = exports.ellint_1 = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var MathUtil_1 = require("../../internal/numeric/MathUtil");
var InvalidArgument_1 = require("../../exception/InvalidArgument");
/* ---------------------------------------------------------------
FIRST
--------------------------------------------------------------- */
/**
* Incomplete elliptic integral of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_first_kind
*/
function ellint_1(k, phi) {
// FORMULA OF INTEGRAL
var formula = function (x) {
return 1.0 / _Common_formula(k, x);
};
return _Post_process("ellint_1", k, phi, formula);
}
exports.ellint_1 = ellint_1;
/**
* Complete elliptic integral of the 1st kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Elliptic_integral_of_the_first_kind
*/
function comp_ellint_1(k) {
return ellint_1(k, Math.PI / 2);
}
exports.comp_ellint_1 = comp_ellint_1;
/* ---------------------------------------------------------------
SECOND
--------------------------------------------------------------- */
/**
* Incomplete elliptic integral of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Incomplete_elliptic_integral_of_the_second_kind
*/
function ellint_2(k, phi) {
var formula = function (x) {
return _Common_formula(k, x);
};
return _Post_process("ellint_2", k, phi, formula);
}
exports.ellint_2 = ellint_2;
/**
* Complete elliptic integral of the 2nd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_second_kind
*/
function comp_ellint_2(k) {
return ellint_2(k, Math.PI / 2);
}
exports.comp_ellint_2 = comp_ellint_2;
/* ---------------------------------------------------------------
THIRD
--------------------------------------------------------------- */
/**
* Incomplete elliptic integral of the 3rd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_third_kind
*/
function ellint_3(k, v, phi) {
// SPECIAL VALIDATIONS ONLY FOR SERIES-3
var predicator = 1 / Math.pow(Math.sin(phi), 2);
if (v > predicator)
throw new InvalidArgument_1.InvalidArgument("Error on std.ellint_3(): must be v < (1 / sin^2(phi)) -> (v = ".concat(v, ", 1 / sin^2(phi) = ").concat(predicator, ")."));
return _Ellint_3(k, v, phi);
}
exports.ellint_3 = ellint_3;
/**
* Complete elliptic integral of the 3rd kind.
*
* @reference https://en.wikipedia.org/wiki/Elliptic_integral#Incomplete_elliptic_integral_of_the_third_kind
*/
function comp_ellint_3(k, n) {
return ellint_3(k, n, Math.PI / 2);
}
exports.comp_ellint_3 = comp_ellint_3;
function _Ellint_3(k, v, phi) {
var formula = function (x) {
var denominator = 1 - v * Math.pow(Math.sin(x), 2);
denominator *= _Common_formula(k, x);
return 1.0 / denominator;
};
return _Post_process("ellint_3", k, phi, formula);
}
/* ---------------------------------------------------------------
BACKGROUNDS
--------------------------------------------------------------- */
function _Common_formula(k, x) {
return Math.sqrt(1 - Math.pow(k * Math.sin(x), 2));
}
function _Post_process(func, k, phi, formula) {
if (Math.abs(k) > 1)
throw new InvalidArgument_1.InvalidArgument("Error on std.".concat(func, "(): must be |k| <= 1 -> (k = ").concat(k, ")."));
var area = MathUtil_1.MathUtil.integral(formula, 0, phi);
return phi < 0 ? -area : area;
}
//# sourceMappingURL=ellints.js.map
-4
View File
@@ -1,4 +0,0 @@
/**
* Exponential integral.
*/
export declare function expint(x: number): number;
-79
View File
@@ -1,79 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.expint = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var MathUtil_1 = require("../../internal/numeric/MathUtil");
/**
* Exponential integral.
*/
function expint(x) {
if (x === 0)
return -Infinity;
else if (x < 0)
return -_E1_G(-x);
else
return _EI_Factorial(x);
}
exports.expint = expint;
function _EI_Factorial(x) {
return (EULER +
Math.log(Math.abs(x)) / Math.log(Math.E) +
MathUtil_1.MathUtil.sigma(function (k) {
return Math.pow(x, k) / (k * MathUtil_1.MathUtil.factorial(k));
}, 1, MAX_K));
}
/* ---------------------------------------------------------------
SWAMEE AND OHIJA APPROXIMATION
--------------------------------------------------------------- */
// function _E1_AB(x: number): number
// {
// const A: number = _Compute_A(x);
// const B: number = _Compute_B(x);
// const ret: number = Math.pow(A, -7.7) + B;
// return Math.pow(ret, -0.13);
// }
// function _Compute_A(x: number): number
// {
// const ret: number = 0.56146 / x + 0.65;
// ret *= 1 + x;
// ret = Math.log(ret) / Math.log(Math.E);
// return ret;
// }
// function _Compute_B(x: number): number
// {
// const ret: number = Math.pow(x, 4);
// ret *= Math.pow(Math.E, 7.7*x);
// ret *= Math.pow(2 + x, 3.7);
// return ret;
// }
/* ---------------------------------------------------------------
BARRY APPROXIMATION
--------------------------------------------------------------- */
function _E1_G(x) {
var h = _Compute_h(x);
var ret = G + (1 - G) * Math.pow(Math.E, -x / (1 - G));
ret = Math.pow(Math.E, -x) / ret;
var ln = 1 + G / x - (1 - G) / Math.pow(h + B * x, 2);
ln = Math.log(ln) / Math.log(Math.E);
return ret * ln;
}
function _Compute_h(x) {
var q = _Compute_q(x);
var left = 1 / (1 + Math.pow(x, 1.5));
var right = (H_INF * q) / (1 + q);
return left + right;
}
function _Compute_q(x) {
return (20 / 47) * Math.pow(x, Math.sqrt(31 / 26));
}
var EULER = 0.5772156649015328606;
var MAX_K = 150;
var G = Math.pow(Math.E, -EULER);
var B = Math.sqrt((2 * (1 - G)) / (G * (2 - G)));
var H_INF = ((1 - G) * (G * G - 6 * G + 12)) / (3 * G * Math.pow(2 - G, 2) * B);
//# sourceMappingURL=expint.js.map
-14
View File
@@ -1,14 +0,0 @@
/**
* @packageDocumentation
* @module std
*/
/**
* Gamma function.
*
* @reference https://en.wikipedia.org/wiki/Gamma_function, https://rosettacode.org/wiki/Gamma_function#JavaScript
*/
export declare function tgamma(x: number): number;
/**
* Log gamma function.
*/
export declare function lgamma(x: number): number;
-41
View File
@@ -1,41 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lgamma = exports.tgamma = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
/**
* Gamma function.
*
* @reference https://en.wikipedia.org/wiki/Gamma_function, https://rosettacode.org/wiki/Gamma_function#JavaScript
*/
function tgamma(x) {
if (x < 0.5)
return Math.PI / (Math.sin(Math.PI * x) * tgamma(1 - x));
/*else if (x >= 1 && x === Math.floor(x))
return base.MathUtil.factorial(x - 1);*/
x -= 1;
var a = P[0];
var t = x + G + 0.5;
for (var i = 1; i < P.length; ++i)
a += P[i] / (x + i);
return Math.sqrt(2 * Math.PI) * Math.pow(t, x + 0.5) * Math.exp(-t) * a;
}
exports.tgamma = tgamma;
/**
* Log gamma function.
*/
function lgamma(x) {
return Math.log(tgamma(x));
}
exports.lgamma = lgamma;
var P = [
0.99999999999980993, 676.5203681218851, -1259.1392167224028,
771.32342877765313, -176.61502916214059, 12.507343278686905,
-0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7,
];
var G = 7;
//# sourceMappingURL=gamma.js.map
-6
View File
@@ -1,6 +0,0 @@
/**
* Hermite polynomial
*
* @reference https://en.wikipedia.org/wiki/Hermite_polynomials
*/
export declare function hermite(n: number, x: number): number;
-36
View File
@@ -1,36 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hermite = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var InvalidArgument_1 = require("../../exception/InvalidArgument");
/**
* Hermite polynomial
*
* @reference https://en.wikipedia.org/wiki/Hermite_polynomials
*/
function hermite(n, x) {
// VALIDATE PARAMETER
if ((n = Math.floor(n)) < 0)
throw new InvalidArgument_1.InvalidArgument("Error on std.hermite(): n must be unsigned integer -> (n = ".concat(n, ")."));
// MEMORIZATION
var solutions = [1, 2 * x];
// COMPUTE RETURN VALUE
return _Hermite(n, x, solutions);
}
exports.hermite = hermite;
function _Hermite(n, x, solutions) {
if (solutions.length > n)
return solutions[n];
var hn_1 = _Hermite(n - 1, x, solutions);
var hn_2 = _Hermite(n - 2, x, solutions);
var ret = x * hn_1 - (n - 1) * hn_2;
ret *= 2;
solutions[n] = ret;
return ret;
}
//# sourceMappingURL=hermite.js.map
-13
View File
@@ -1,13 +0,0 @@
/**
* @packageDocumentation
* @module std
*/
export * from "./beta";
export * from "./gamma";
export * from "./bessels";
export * from "./ellints";
export * from "./expint";
export * from "./hermite";
export * from "./legendres";
export * from "./laguerres";
export * from "./zeta";
-36
View File
@@ -1,36 +0,0 @@
"use strict";
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
// <special_math>
//
// @reference http://en.cppreference.com/w/cpp/numeric/special_math
// @author Jeongho Nam - https://github.com/samchon
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./beta"), exports);
__exportStar(require("./gamma"), exports);
__exportStar(require("./bessels"), exports);
__exportStar(require("./ellints"), exports);
__exportStar(require("./expint"), exports);
__exportStar(require("./hermite"), exports);
__exportStar(require("./legendres"), exports);
__exportStar(require("./laguerres"), exports);
__exportStar(require("./zeta"), exports);
//# sourceMappingURL=index.js.map
-12
View File
@@ -1,12 +0,0 @@
/**
* Laguerre polynomials.
*
* @reference https://en.wikipedia.org/wiki/Laguerre_polynomials
*/
export declare function laguerre(n: number, x: number): number;
/**
* Associated laguerre polynomials.
*
* @reference https://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials
*/
export declare function assoc_laguerre(n: number, m: number, x: number): number;
-45
View File
@@ -1,45 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assoc_laguerre = exports.laguerre = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var InvalidArgument_1 = require("../../exception/InvalidArgument");
/**
* Laguerre polynomials.
*
* @reference https://en.wikipedia.org/wiki/Laguerre_polynomials
*/
function laguerre(n, x) {
return assoc_laguerre(n, 0, x);
}
exports.laguerre = laguerre;
/**
* Associated laguerre polynomials.
*
* @reference https://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials
*/
function assoc_laguerre(n, m, x) {
// VALIDATE PARAMETERS
if ((n = Math.floor(n)) < 0 || (m = Math.floor(m)) < 0)
throw new InvalidArgument_1.InvalidArgument("Error on std.assoc_laguerre(): both n and m must be unsigned integer -> (n = ".concat(n, ", m = ").concat(m, ")."));
// MEMORIZATION
var solutions = [1, -x + m + 1];
// COMPUTE RETURN VALUE
return _Compute_assoc_laguerre(n, m, x, solutions);
}
exports.assoc_laguerre = assoc_laguerre;
function _Compute_assoc_laguerre(n, m, x, solutions) {
if (solutions.length > n)
return solutions[n];
var ln_1 = _Compute_assoc_laguerre(n - 1, m, x, solutions);
var ln_2 = _Compute_assoc_laguerre(n - 2, m, x, solutions);
var ret = (2 * n - 1 + m - x) * ln_1 - (n + m - 1) * ln_2;
ret = ret / n;
solutions[n] = ret;
return ret;
}
//# sourceMappingURL=laguerres.js.map
-12
View File
@@ -1,12 +0,0 @@
/**
* Legendre polynomials.
*
* @reference http://en.cppreference.com/w/cpp/numeric/special_math/legendre
*/
export declare function legendre(n: number, x: number): number;
/**
* Associated Legendre polynomials.
*
* @reference https://en.wikipedia.org/wiki/Associated_Legendre_polynomials
*/
export declare function assoc_legendre(n: number, m: number, x: number): number;
-68
View File
@@ -1,68 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assoc_legendre = exports.legendre = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var InvalidArgument_1 = require("../../exception/InvalidArgument");
/**
* Legendre polynomials.
*
* @reference http://en.cppreference.com/w/cpp/numeric/special_math/legendre
*/
function legendre(n, x) {
return assoc_legendre(n, 0, x);
}
exports.legendre = legendre;
/**
* Associated Legendre polynomials.
*
* @reference https://en.wikipedia.org/wiki/Associated_Legendre_polynomials
*/
function assoc_legendre(n, m, x) {
// VALIDATE PARAMETERS
if ((n = Math.floor(n)) < 0 || (m = Math.floor(m)) < 0)
throw new InvalidArgument_1.InvalidArgument("Error on std.assoc_legendre(): both n and m must be unsigned integer -> (n = ".concat(n, ", m = ").concat(m, ")."));
else if (Math.abs(x) > 1)
throw new InvalidArgument_1.InvalidArgument("Error on std.assoc_legendre(): must be |x| <= 1 -> (x = ".concat(x, ")."));
// MEMORIZATION
var matrix = [[1, x]];
matrix.length = m + 1;
for (var i = 1; i < matrix.length; ++i)
matrix[i] = [];
// COMPUTE RETURN VALUE
return _Compute_assoc_legendre(n, m, x, matrix);
}
exports.assoc_legendre = assoc_legendre;
function _Compute_legendre(n, x, memory) {
if (memory.length > n)
return memory[n];
var pn_1 = _Compute_legendre(n - 1, x, memory);
var pn_2 = _Compute_legendre(n - 2, x, memory);
var ret = (2 * n - 1) * x * pn_1 - (n - 1) * pn_2;
ret /= n;
memory[n] = ret;
return ret;
}
function _Compute_assoc_legendre(n, m, x, matrix) {
if (n < 0)
n = -n - 1;
if (m === 0)
return _Compute_legendre(n, x, matrix[0]);
else if (matrix[m].length > n && matrix[m][n] !== undefined)
return matrix[m][n];
var left = (n - m + 1) *
(n - m + 2) *
_Compute_assoc_legendre(n + 1, m - 1, x, matrix);
var right = (n + m - 1) *
(n + m) *
_Compute_assoc_legendre(n - 1, m - 1, x, matrix);
var ret = (left - right) / (2 * n + 1);
ret /= Math.sqrt(1 - x * x);
matrix[m][n] = ret;
return ret;
}
//# sourceMappingURL=legendres.js.map
-6
View File
@@ -1,6 +0,0 @@
/**
* Riemann zeta function.
*
* @reference http://en.cppreference.com/w/cpp/numeric/special_math/riemann_zeta
*/
export declare function riemann_zeta(arg: number): number;
-50
View File
@@ -1,50 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.riemann_zeta = void 0;
//================================================================
/**
* @packageDocumentation
* @module std
*/
//================================================================
var MathUtil_1 = require("../../internal/numeric/MathUtil");
var gamma_1 = require("./gamma");
/**
* Riemann zeta function.
*
* @reference http://en.cppreference.com/w/cpp/numeric/special_math/riemann_zeta
*/
function riemann_zeta(arg) {
if (arg < 0)
return _Negative(arg);
else if (arg === 0)
return -0.5;
else if (arg < 1)
return _Fractional(arg);
else if (arg === 1)
return Infinity;
else
return _Positive(arg);
}
exports.riemann_zeta = riemann_zeta;
function _Negative(arg) {
return (Math.pow(2, arg) *
Math.pow(Math.PI, arg - 1) *
Math.sin((Math.PI * arg) / 2) *
(0, gamma_1.tgamma)(1 - arg) *
riemann_zeta(1 - arg));
}
function _Fractional(arg) {
var divider = 1 - Math.pow(2, 1 - arg);
var sigma = MathUtil_1.MathUtil.sigma(function (n) {
return Math.pow(-1, n - 1) * Math.pow(n, -arg);
}, 1, INFINITY);
return sigma / divider;
}
function _Positive(arg) {
return MathUtil_1.MathUtil.sigma(function (n) {
return Math.pow(n, -arg);
}, 1, INFINITY);
}
var INFINITY = 100 * 1000;
//# sourceMappingURL=zeta.js.map