@stdlib/stats-base-dists-triangular-ctor 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CITATION.cff ADDED
@@ -0,0 +1,30 @@
1
+ cff-version: 1.2.0
2
+ title: stdlib
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+
7
+ type: software
8
+
9
+ authors:
10
+ - name: The Stdlib Authors
11
+ url: https://github.com/stdlib-js/stdlib/graphs/contributors
12
+
13
+ repository-code: https://github.com/stdlib-js/stdlib
14
+ url: https://stdlib.io
15
+
16
+ abstract: |
17
+ Standard library for JavaScript and Node.js.
18
+
19
+ keywords:
20
+ - JavaScript
21
+ - Node.js
22
+ - TypeScript
23
+ - standard library
24
+ - scientific computing
25
+ - numerical computing
26
+ - statistical computing
27
+
28
+ license: Apache-2.0 AND BSL-1.0
29
+
30
+ date-released: 2016
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2022 The Stdlib Authors.
1
+ Copyright (c) 2016-2023 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # Triangular
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -368,7 +379,7 @@ See [LICENSE][stdlib-license].
368
379
 
369
380
  ## Copyright
370
381
 
371
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
382
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
372
383
 
373
384
  </section>
374
385
 
@@ -381,8 +392,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
381
392
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-triangular-ctor.svg
382
393
  [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-triangular-ctor
383
394
 
384
- [test-image]: https://github.com/stdlib-js/stats-base-dists-triangular-ctor/actions/workflows/test.yml/badge.svg?branch=v0.0.8
385
- [test-url]: https://github.com/stdlib-js/stats-base-dists-triangular-ctor/actions/workflows/test.yml?query=branch:v0.0.8
395
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-triangular-ctor/actions/workflows/test.yml/badge.svg?branch=v0.1.0
396
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-triangular-ctor/actions/workflows/test.yml?query=branch:v0.1.0
386
397
 
387
398
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-triangular-ctor/main.svg
388
399
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-triangular-ctor?branch=main
@@ -395,7 +406,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
395
406
  -->
396
407
 
397
408
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
398
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
409
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
399
410
 
400
411
  [stdlib]: https://github.com/stdlib-js/stdlib
401
412
 
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import Triangular from '../docs/types/index';
3
+ export = Triangular;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var c=function(t,i){return function(){return i||t((i={exports:{}}).exports,i),i.exports}};var p=c(function(N,g){
2
+ var f=require('@stdlib/utils-define-property/dist'),h=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),a=require('@stdlib/utils-define-nonenumerable-read-only-accessor/dist'),u=require('@stdlib/assert-is-number/dist').isPrimitive,o=require('@stdlib/math-base-assert-is-nan/dist'),b=require('@stdlib/stats-base-dists-triangular-entropy/dist'),l=require('@stdlib/stats-base-dists-triangular-kurtosis/dist'),d=require('@stdlib/stats-base-dists-triangular-mean/dist'),q=require('@stdlib/stats-base-dists-triangular-median/dist'),y=require('@stdlib/stats-base-dists-triangular-mode/dist'),w=require('@stdlib/stats-base-dists-triangular-skewness/dist'),v=require('@stdlib/stats-base-dists-triangular-stdev/dist'),E=require('@stdlib/stats-base-dists-triangular-variance/dist'),M=require('@stdlib/stats-base-dists-triangular-cdf/dist'),V=require('@stdlib/stats-base-dists-triangular-logcdf/dist'),T=require('@stdlib/stats-base-dists-triangular-logpdf/dist'),R=require('@stdlib/stats-base-dists-triangular-mgf/dist'),x=require('@stdlib/stats-base-dists-triangular-pdf/dist'),F=require('@stdlib/stats-base-dists-triangular-quantile/dist'),s=require('@stdlib/error-tools-fmtprodmsg/dist');function P(t){return M(t,this.a,this.b,this.c)}function k(t){return V(t,this.a,this.b,this.c)}function D(t){return T(t,this.a,this.b,this.c)}function C(t){return R(t,this.a,this.b,this.c)}function L(t){return x(t,this.a,this.b,this.c)}function O(t){return F(t,this.a,this.b,this.c)}function e(){var t,i,n;if(!(this instanceof e))return arguments.length===0?new e:new e(arguments[0],arguments[1],arguments[2]);if(arguments.length){if(t=arguments[0],i=arguments[1],n=arguments[2],!u(t)||o(t))throw new TypeError(s('18d8a',t));if(!u(i)||o(i))throw new TypeError(s('18d8b',i));if(!u(n)||o(n))throw new TypeError(s('18d9B',n));if(!(t<=n&&n<=i))throw new RangeError(s('18d9C',"a <= c <= b",t,i,n))}else t=0,i=1,n=.5;return f(this,"a",{configurable:!1,enumerable:!0,get:function(){return t},set:function(r){if(!u(r)||o(r))throw new TypeError(s('18d8d',r));if(r>i||r>n)throw new RangeError(s('18d9D',r));t=r}}),f(this,"b",{configurable:!1,enumerable:!0,get:function(){return i},set:function(r){if(!u(r)||o(r))throw new TypeError(s('18d8d',r));if(t>r||n>r)throw new RangeError(s('18d9E',r));i=r}}),f(this,"c",{configurable:!1,enumerable:!0,get:function(){return n},set:function(r){if(!u(r)||o(r))throw new TypeError(s('18d8d',r));if(t>r||i<r)throw new RangeError(s('18d9F',r));n=r}}),this;}a(e.prototype,"entropy",function(){return b(this.a,this.b,this.c)});a(e.prototype,"kurtosis",function(){return l(this.a,this.b,this.c)});a(e.prototype,"mean",function(){return d(this.a,this.b,this.c)});a(e.prototype,"median",function(){return q(this.a,this.b,this.c)});a(e.prototype,"mode",function(){return y(this.a,this.b,this.c)});a(e.prototype,"skewness",function(){return w(this.a,this.b,this.c)});a(e.prototype,"stdev",function(){return v(this.a,this.b,this.c)});a(e.prototype,"variance",function(){return E(this.a,this.b,this.c)});h(e.prototype,"cdf",P);h(e.prototype,"logcdf",k);h(e.prototype,"logpdf",D);h(e.prototype,"mgf",C);h(e.prototype,"pdf",L);h(e.prototype,"quantile",O);g.exports=e
3
+ });var A=p();module.exports=A;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar entropy = require( '@stdlib/stats-base-dists-triangular-entropy' );\nvar kurtosis = require( '@stdlib/stats-base-dists-triangular-kurtosis' );\nvar mean = require( '@stdlib/stats-base-dists-triangular-mean' );\nvar median = require( '@stdlib/stats-base-dists-triangular-median' );\nvar mode = require( '@stdlib/stats-base-dists-triangular-mode' );\nvar skewness = require( '@stdlib/stats-base-dists-triangular-skewness' );\nvar stdev = require( '@stdlib/stats-base-dists-triangular-stdev' );\nvar variance = require( '@stdlib/stats-base-dists-triangular-variance' );\nvar cdf = require( '@stdlib/stats-base-dists-triangular-cdf' );\nvar logcdf = require( '@stdlib/stats-base-dists-triangular-logcdf' );\nvar logpdf = require( '@stdlib/stats-base-dists-triangular-logpdf' );\nvar mgf = require( '@stdlib/stats-base-dists-triangular-mgf' );\nvar pdf = require( '@stdlib/stats-base-dists-triangular-pdf' );\nvar quantile = require( '@stdlib/stats-base-dists-triangular-quantile' );\nvar format = require( '@stdlib/string-format' );\n\n\n// FUNCTIONS //\n\n/**\n* Evaluates the cumulative distribution function (CDF).\n*\n* @private\n* @param {number} x - input value\n* @returns {Probability} evaluated CDF\n*/\nfunction triangularCDF( x ) {\n\treturn cdf( x, this.a, this.b, this.c );\n}\n\n/**\n* Evaluates the natural logarithm of the cumulative distribution function (CDF).\n*\n* @private\n* @param {number} x - input value\n* @returns {number} evaluated logCDF\n*/\nfunction triangularLogCDF( x ) {\n\treturn logcdf( x, this.a, this.b, this.c );\n}\n\n/**\n* Evaluates the natural logarithm of the probability density function (PDF).\n*\n* @private\n* @param {number} x - input value\n* @returns {number} evaluated logPDF\n*/\nfunction triangularLogPDF( x ) {\n\treturn logpdf( x, this.a, this.b, this.c );\n}\n\n/**\n* Evaluates the moment-generating function (MGF).\n*\n* @private\n* @param {number} t - input value\n* @returns {number} evaluated MGF\n*/\nfunction triangularMGF( t ) {\n\treturn mgf( t, this.a, this.b, this.c );\n}\n\n/**\n* Evaluates the probability density function (PDF).\n*\n* @private\n* @param {number} x - input value\n* @returns {number} evaluated PDF\n*/\nfunction triangularPDF( x ) {\n\treturn pdf( x, this.a, this.b, this.c );\n}\n\n/**\n* Evaluates the quantile function.\n*\n* @private\n* @param {Probability} p - input probability\n* @returns {number} evaluated quantile function\n*/\nfunction triangularQuantile( p ) {\n\treturn quantile( p, this.a, this.b, this.c );\n}\n\n\n// MAIN //\n\n/**\n* Triangular distribution constructor.\n*\n* @constructor\n* @param {number} [a=0.0] - minimum support\n* @param {number} [b=1.0] - maximum support\n* @param {number} [c=0.5] - mode\n* @throws {TypeError} `a` must be a number\n* @throws {TypeError} `b` must be a number\n* @throws {TypeError} `c` must be a number\n* @throws {RangeError} `a` must be less than or equal to `b` and `c`\n* @throws {RangeError} `b` must be greater than or equal to `a` and `b`\n* @throws {RangeError} `c` must be greater than or equal to `a` and smaller than or equal to `b`\n* @returns {Triangular} distribution instance\n*\n* @example\n* var triangular = new Triangular( 0.0, 1.0, 0.25 );\n*\n* var y = triangular.cdf( 0.8 );\n* // returns ~0.947\n*\n* var mu = triangular.mean;\n* // returns ~0.417\n*/\nfunction Triangular() {\n\tvar a;\n\tvar b;\n\tvar c;\n\tif ( !(this instanceof Triangular) ) {\n\t\tif ( arguments.length === 0 ) {\n\t\t\treturn new Triangular();\n\t\t}\n\t\treturn new Triangular( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] );\n\t}\n\tif ( arguments.length ) {\n\t\ta = arguments[ 0 ];\n\t\tb = arguments[ 1 ];\n\t\tc = arguments[ 2 ];\n\t\tif ( !isNumber( a ) || isnan( a ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Minimum support must be a number. Value: `%s`.', a ) );\n\t\t}\n\t\tif ( !isNumber( b ) || isnan( b ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Maximum support must be a number. Value: `%s`.', b ) );\n\t\t}\n\t\tif ( !isNumber( c ) || isnan( c ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Mode must be a number. Value: `%s`.', c ) );\n\t\t}\n\t\tif ( !( a <= c && c <= b ) ) {\n\t\t\tthrow new RangeError( format( 'invalid arguments. Parameters must satisfy the following condition: %s. a: `%f`. b: `%f`. c: `%f`.', 'a <= c <= b', a, b, c ) );\n\t\t}\n\t} else {\n\t\ta = 0.0;\n\t\tb = 1.0;\n\t\tc = 0.5;\n\t}\n\tdefineProperty( this, 'a', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'get': function get() {\n\t\t\treturn a;\n\t\t},\n\t\t'set': function set( value ) {\n\t\t\tif ( !isNumber( value ) || isnan( value ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid assignment. Must be a number. Value: `%s`.', value ) );\n\t\t\t}\n\t\t\tif ( value > b || value > c ) {\n\t\t\t\tthrow new RangeError( format( 'invalid assignment. Must be less than or equal to both the maximum support and the mode. Value: `%f`.', value ) );\n\t\t\t}\n\t\t\ta = value;\n\t\t}\n\t});\n\tdefineProperty( this, 'b', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'get': function get() {\n\t\t\treturn b;\n\t\t},\n\t\t'set': function set( value ) {\n\t\t\tif ( !isNumber( value ) || isnan( value ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid assignment. Must be a number. Value: `%s`.', value ) );\n\t\t\t}\n\t\t\tif ( a > value || c > value ) {\n\t\t\t\tthrow new RangeError( format( 'invalid assignment. Must be greater than or equal to both the minimum support and the mode. Value: `%f`.', value ) );\n\t\t\t}\n\t\t\tb = value;\n\t\t}\n\t});\n\tdefineProperty( this, 'c', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'get': function get() {\n\t\t\treturn c;\n\t\t},\n\t\t'set': function set( value ) {\n\t\t\tif ( !isNumber( value ) || isnan( value ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid assignment. Must be a number. Value: `%s`.', value ) );\n\t\t\t}\n\t\t\tif ( a > value || b < value ) {\n\t\t\t\tthrow new RangeError( format( 'invalid assignment. Must be greater than or equal to the minimum support and less than or equal to the maximum support. Value: `%f`.', value ) );\n\t\t\t}\n\t\t\tc = value;\n\t\t}\n\t});\n\treturn this;\n}\n\n/**\n* Triangular distribution differential entropy.\n*\n* @name entropy\n* @memberof Triangular.prototype\n* @type {number}\n* @see [differential entropy]{@link https://en.wikipedia.org/wiki/Entropy_%28information_theory%29}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.entropy;\n* // returns ~1.886\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'entropy', function get() {\n\treturn entropy( this.a, this.b, this.c );\n});\n\n/**\n* Triangular distribution excess kurtosis.\n*\n* @name kurtosis\n* @memberof Triangular.prototype\n* @type {number}\n* @see [kurtosis]{@link https://en.wikipedia.org/wiki/Kurtosis}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.kurtosis;\n* // returns -0.6\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'kurtosis', function get() {\n\treturn kurtosis( this.a, this.b, this.c );\n});\n\n/**\n* Triangular distribution expected value.\n*\n* @name mean\n* @memberof Triangular.prototype\n* @type {number}\n* @see [expected value]{@link https://en.wikipedia.org/wiki/Expected_value}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.mean;\n* // returns ~8.667\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'mean', function get() {\n\treturn mean( this.a, this.b, this.c );\n});\n\n/**\n* Triangular distribution median.\n*\n* @name median\n* @memberof Triangular.prototype\n* @type {number}\n* @see [median]{@link https://en.wikipedia.org/wiki/Median}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.median;\n* // returns ~8.899\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'median', function get() {\n\treturn median( this.a, this.b, this.c );\n});\n\n/**\n* Triangular distribution mode.\n*\n* @name mode\n* @memberof Triangular.prototype\n* @type {number}\n* @see [mode]{@link https://en.wikipedia.org/wiki/Mode_%28statistics%29}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.mode;\n* // returns 10.0\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'mode', function get() {\n\treturn mode( this.a, this.b, this.c );\n});\n\n/**\n* Triangular distribution skewness.\n*\n* @name skewness\n* @memberof Triangular.prototype\n* @type {number}\n* @see [skewness]{@link https://en.wikipedia.org/wiki/Skewness}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.skewness;\n* // returns ~-0.422\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'skewness', function get() {\n\treturn skewness( this.a, this.b, this.c );\n});\n\n/**\n* Triangular distribution standard deviation.\n*\n* @name stdev\n* @memberof Triangular.prototype\n* @type {PositiveNumber}\n* @see [standard deviation]{@link https://en.wikipedia.org/wiki/Standard_deviation}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.stdev;\n* // returns ~1.7\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'stdev', function get() {\n\treturn stdev( this.a, this.b, this.c );\n});\n\n/**\n* Triangular distribution variance.\n*\n* @name variance\n* @memberof Triangular.prototype\n* @type {PositiveNumber}\n* @see [variance]{@link https://en.wikipedia.org/wiki/Variance}\n*\n* @example\n* var triangular = new Triangular( 4.0, 12.0, 10.0 );\n*\n* var v = triangular.variance;\n* // returns ~2.889\n*/\nsetReadOnlyAccessor( Triangular.prototype, 'variance', function get() {\n\treturn variance( this.a, this.b, this.c );\n});\n\n/**\n* Evaluates the cumulative distribution function (CDF).\n*\n* @name cdf\n* @memberof Triangular.prototype\n* @type {Function}\n* @param {number} x - input value\n* @returns {Probability} evaluated CDF\n* @see [cdf]{@link https://en.wikipedia.org/wiki/Cumulative_distribution_function}\n*\n* @example\n* var triangular = new Triangular( 2.0, 4.0, 3.0 );\n*\n* var v = triangular.cdf( 3.0 );\n* // returns 0.5\n*/\nsetReadOnly( Triangular.prototype, 'cdf', triangularCDF );\n\n/**\n* Evaluates the natural logarithm of the cumulative distribution function (CDF).\n*\n* @name logcdf\n* @memberof Triangular.prototype\n* @type {Function}\n* @param {number} x - input value\n* @returns {number} evaluated logCDF\n* @see [cdf]{@link https://en.wikipedia.org/wiki/Cumulative_distribution_function}\n*\n* @example\n* var triangular = new Triangular( 2.0, 4.0, 3.0 );\n*\n* var v = triangular.logcdf( 3.0 );\n* // returns ~-0.693\n*/\nsetReadOnly( Triangular.prototype, 'logcdf', triangularLogCDF );\n\n/**\n* Evaluates the natural logarithm of the probability density function (PDF).\n*\n* @name logpdf\n* @memberof Triangular.prototype\n* @type {Function}\n* @param {number} x - input value\n* @returns {number} evaluated logPDF\n* @see [pdf]{@link https://en.wikipedia.org/wiki/Probability_density_function}\n*\n* @example\n* var triangular = new Triangular( 2.0, 4.0, 3.0 );\n*\n* var v = triangular.logpdf( 2.4 );\n* // returns ~-0.916\n*/\nsetReadOnly( Triangular.prototype, 'logpdf', triangularLogPDF );\n\n/**\n* Evaluates the moment-generating function (MGF).\n*\n* @name mgf\n* @memberof Triangular.prototype\n* @type {Function}\n* @param {number} t - input value\n* @returns {number} evaluated MGF\n* @see [mgf]{@link https://en.wikipedia.org/wiki/Moment-generating_function}\n*\n* @example\n* var triangular = new Triangular( 2.0, 4.0, 3.0 );\n*\n* var v = triangular.mgf( 0.5 );\n* // returns ~4.576\n*/\nsetReadOnly( Triangular.prototype, 'mgf', triangularMGF );\n\n/**\n* Evaluates the probability density function (PDF).\n*\n* @name pdf\n* @memberof Triangular.prototype\n* @type {Function}\n* @param {number} x - input value\n* @returns {number} evaluated PDF\n* @see [pdf]{@link https://en.wikipedia.org/wiki/Probability_density_function}\n*\n* @example\n* var triangular = new Triangular( 2.0, 4.0, 3.0 );\n*\n* var v = triangular.pdf( 2.4 );\n* // returns ~0.40\n*/\nsetReadOnly( Triangular.prototype, 'pdf', triangularPDF );\n\n/**\n* Evaluates the quantile function.\n*\n* @name quantile\n* @memberof Triangular.prototype\n* @type {Function}\n* @param {Probability} p - input probability\n* @returns {number} evaluated quantile function\n* @see [quantile function]{@link https://en.wikipedia.org/wiki/Quantile_function}\n*\n* @example\n* var triangular = new Triangular( 2.0, 4.0, 3.0 );\n*\n* var v = triangular.quantile( 0.5 );\n* // returns 3.0\n*/\nsetReadOnly( Triangular.prototype, 'quantile', triangularQuantile );\n\n\n// EXPORTS //\n\nmodule.exports = Triangular;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Triangular distribution constructor.\n*\n* @module @stdlib/stats-base-dists-triangular-ctor\n*\n* @example\n* var Triangular = require( '@stdlib/stats-base-dists-triangular-ctor' );\n*\n* var triangular = new Triangular( 0.0, 1.0, 0.5 );\n*\n* var y = triangular.cdf( 0.8 );\n* // returns 0.92\n*\n* var mu = triangular.mean;\n* // returns 0.5\n*/\n\n// MODULES //\n\nvar main = require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AAW,WAAY,UAAe,CACrE,OAAOlB,EAAU,KAAK,EAAG,KAAK,EAAG,KAAK,CAAE,CACzC,CAAC,EAgBDR,EAAqB0B,EAAW,UAAW,QAAS,UAAe,CAClE,OAAOjB,EAAO,KAAK,EAAG,KAAK,EAAG,KAAK,CAAE,CACtC,CAAC,EAgBDT,EAAqB0B,EAAW,UAAW,WAAY,UAAe,CACrE,OAAOhB,EAAU,KAAK,EAAG,KAAK,EAAG,KAAK,CAAE,CACzC,CAAC,EAkBDX,EAAa2B,EAAW,UAAW,MAAOR,CAAc,EAkBxDnB,EAAa2B,EAAW,UAAW,SAAUN,CAAiB,EAkB9DrB,EAAa2B,EAAW,UAAW,SAAUL,CAAiB,EAkB9DtB,EAAa2B,EAAW,UAAW,MAAOJ,CAAc,EAkBxDvB,EAAa2B,EAAW,UAAW,MAAOH,CAAc,EAkBxDxB,EAAa2B,EAAW,UAAW,WAAYF,CAAmB,EAKlE3B,EAAO,QAAU6B,ICvbjB,IAAIK,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "defineProperty", "setReadOnly", "setReadOnlyAccessor", "isNumber", "isnan", "entropy", "kurtosis", "mean", "median", "mode", "skewness", "stdev", "variance", "cdf", "logcdf", "logpdf", "mgf", "pdf", "quantile", "format", "triangularCDF", "x", "triangularLogCDF", "triangularLogPDF", "triangularMGF", "triangularPDF", "triangularQuantile", "p", "Triangular", "a", "b", "c", "value", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * Triangular Distribution.
package/lib/index.js CHANGED
@@ -37,9 +37,9 @@
37
37
 
38
38
  // MODULES //
39
39
 
40
- var ctor = require( './ctor.js' );
40
+ var main = require( './main.js' );
41
41
 
42
42
 
43
43
  // EXPORTS //
44
44
 
45
- module.exports = ctor;
45
+ module.exports = main;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-base-dists-triangular-ctor",
3
- "version": "0.0.8",
3
+ "version": "0.1.0",
4
4
  "description": "Triangular distribution constructor.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,36 +37,37 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/assert-is-number": "^0.0.x",
41
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
42
- "@stdlib/stats-base-dists-triangular-cdf": "^0.0.x",
43
- "@stdlib/stats-base-dists-triangular-entropy": "^0.0.x",
44
- "@stdlib/stats-base-dists-triangular-kurtosis": "^0.0.x",
45
- "@stdlib/stats-base-dists-triangular-logcdf": "^0.0.x",
46
- "@stdlib/stats-base-dists-triangular-logpdf": "^0.0.x",
47
- "@stdlib/stats-base-dists-triangular-mean": "^0.0.x",
48
- "@stdlib/stats-base-dists-triangular-median": "^0.0.x",
49
- "@stdlib/stats-base-dists-triangular-mgf": "^0.0.x",
50
- "@stdlib/stats-base-dists-triangular-mode": "^0.0.x",
51
- "@stdlib/stats-base-dists-triangular-pdf": "^0.0.x",
52
- "@stdlib/stats-base-dists-triangular-quantile": "^0.0.x",
53
- "@stdlib/stats-base-dists-triangular-skewness": "^0.0.x",
54
- "@stdlib/stats-base-dists-triangular-stdev": "^0.0.x",
55
- "@stdlib/stats-base-dists-triangular-variance": "^0.0.x",
56
- "@stdlib/string-format": "^0.0.x",
57
- "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.0.x",
58
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
59
- "@stdlib/utils-define-property": "^0.0.x"
40
+ "@stdlib/assert-is-number": "^0.1.0",
41
+ "@stdlib/math-base-assert-is-nan": "^0.1.0",
42
+ "@stdlib/stats-base-dists-triangular-cdf": "^0.1.0",
43
+ "@stdlib/stats-base-dists-triangular-entropy": "^0.1.0",
44
+ "@stdlib/stats-base-dists-triangular-kurtosis": "^0.1.0",
45
+ "@stdlib/stats-base-dists-triangular-logcdf": "^0.1.0",
46
+ "@stdlib/stats-base-dists-triangular-logpdf": "^0.1.0",
47
+ "@stdlib/stats-base-dists-triangular-mean": "^0.1.0",
48
+ "@stdlib/stats-base-dists-triangular-median": "^0.1.0",
49
+ "@stdlib/stats-base-dists-triangular-mgf": "^0.1.0",
50
+ "@stdlib/stats-base-dists-triangular-mode": "^0.1.0",
51
+ "@stdlib/stats-base-dists-triangular-pdf": "^0.1.0",
52
+ "@stdlib/stats-base-dists-triangular-quantile": "^0.1.0",
53
+ "@stdlib/stats-base-dists-triangular-skewness": "^0.1.0",
54
+ "@stdlib/stats-base-dists-triangular-stdev": "^0.1.0",
55
+ "@stdlib/stats-base-dists-triangular-variance": "^0.1.0",
56
+ "@stdlib/string-format": "^0.1.0",
57
+ "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.1.0",
58
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0",
59
+ "@stdlib/utils-define-property": "^0.1.0",
60
+ "@stdlib/error-tools-fmtprodmsg": "^0.1.0"
60
61
  },
61
62
  "devDependencies": {
62
- "@stdlib/assert-has-own-property": "^0.0.x",
63
- "@stdlib/assert-is-function": "^0.0.x",
64
- "@stdlib/bench": "^0.0.x",
65
- "@stdlib/constants-float64-eps": "^0.0.x",
66
- "@stdlib/random-base-randu": "^0.0.x",
63
+ "@stdlib/assert-has-own-property": "^0.1.0",
64
+ "@stdlib/assert-is-function": "^0.1.0",
65
+ "@stdlib/bench": "^0.1.0",
66
+ "@stdlib/constants-float64-eps": "^0.1.0",
67
+ "@stdlib/random-base-randu": "^0.0.8",
67
68
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
68
69
  "istanbul": "^0.4.1",
69
- "tap-spec": "5.x.x"
70
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
70
71
  },
71
72
  "engines": {
72
73
  "node": ">=0.10.0"
@@ -105,7 +106,7 @@
105
106
  "continuous"
106
107
  ],
107
108
  "funding": {
108
- "type": "patreon",
109
- "url": "https://www.patreon.com/athan"
109
+ "type": "opencollective",
110
+ "url": "https://opencollective.com/stdlib"
110
111
  }
111
112
  }
package/docs/repl.txt DELETED
@@ -1,117 +0,0 @@
1
-
2
- {{alias}}( [a, b, c] )
3
- Returns a triangular distribution object.
4
-
5
- Parameters
6
- ----------
7
- a: number (optional)
8
- Minimum support. Must be smaller than `b` and `c`. Default: `0.0`.
9
-
10
- b: number (optional)
11
- Maximum support. Must be greater than `a` and `c`. Default: `1.0`.
12
-
13
- c: number (optional)
14
- Mode. Must be greater than `a` and smaller than `b`. Default: `0.5`.
15
-
16
- Returns
17
- -------
18
- triangular: Object
19
- Distribution instance.
20
-
21
- triangular.a: number
22
- Minimum support. If set, the value must be smaller or equal to `b` and
23
- `c`.
24
-
25
- triangular.b: number
26
- Maximum support. If set, the value must be greater than or equal to `a`
27
- and `c`.
28
-
29
- triangular.c: number
30
- Mode. If set, the value must be greater than or equal to `a` and smaller
31
- than or equal to `b`.
32
-
33
- triangular.entropy: number
34
- Read-only property which returns the differential entropy.
35
-
36
- triangular.kurtosis: number
37
- Read-only property which returns the excess kurtosis.
38
-
39
- triangular.mean: number
40
- Read-only property which returns the expected value.
41
-
42
- triangular.median: number
43
- Read-only property which returns the median.
44
-
45
- triangular.mode: number
46
- Read-only property which returns the mode.
47
-
48
- triangular.skewness: number
49
- Read-only property which returns the skewness.
50
-
51
- triangular.stdev: number
52
- Read-only property which returns the standard deviation.
53
-
54
- triangular.variance: number
55
- Read-only property which returns the variance.
56
-
57
- triangular.cdf: Function
58
- Evaluates the cumulative distribution function (CDF).
59
-
60
- triangular.logcdf: Function
61
- Evaluates the natural logarithm of the cumulative distribution function
62
- (CDF).
63
-
64
- triangular.logpdf: Function
65
- Evaluates the natural logarithm of the probability density function
66
- (PDF).
67
-
68
- triangular.mgf: Function
69
- Evaluates the moment-generating function (MGF).
70
-
71
- triangular.pdf: Function
72
- Evaluates the probability density function (PDF).
73
-
74
- triangular.quantile: Function
75
- Evaluates the quantile function at probability `p`.
76
-
77
- Examples
78
- --------
79
- > var triangular = {{alias}}( 0.0, 1.0, 0.5 );
80
- > triangular.a
81
- 0.0
82
- > triangular.b
83
- 1.0
84
- > triangular.c
85
- 0.5
86
- > triangular.entropy
87
- ~-0.193
88
- > triangular.kurtosis
89
- -0.6
90
- > triangular.mean
91
- 0.5
92
- > triangular.median
93
- 0.5
94
- > triangular.mode
95
- 0.5
96
- > triangular.skewness
97
- 0.0
98
- > triangular.stdev
99
- ~0.204
100
- > triangular.variance
101
- ~0.042
102
- > triangular.cdf( 0.8 )
103
- 0.92
104
- > triangular.logcdf( 0.8 )
105
- ~-0.083
106
- > triangular.logpdf( 0.8 )
107
- ~-0.223
108
- > triangular.mgf( 0.8 )
109
- ~1.512
110
- > triangular.pdf( 0.8 )
111
- ~0.8
112
- > triangular.quantile( 0.8 )
113
- ~0.684
114
-
115
- See Also
116
- --------
117
-
@@ -1,61 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2021 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- /* tslint:disable:no-unused-expression */
20
-
21
- import Triangular = require( './index' );
22
-
23
-
24
- // TESTS //
25
-
26
- // The function returns a distribution instance...
27
- {
28
- new Triangular(); // $ExpectType Triangular
29
- new Triangular( 1.0, 2.0, 1.5 ); // $ExpectType Triangular
30
- }
31
-
32
- // The compiler throws an error if the function is provided values other than three numbers...
33
- {
34
- new Triangular( true, 2.0, 1.5 ); // $ExpectError
35
- new Triangular( false, 2.0, 1.5 ); // $ExpectError
36
- new Triangular( '5', 2.0, 1.5 ); // $ExpectError
37
- new Triangular( [], 2.0, 1.5 ); // $ExpectError
38
- new Triangular( {}, 2.0, 1.5 ); // $ExpectError
39
- new Triangular( ( x: number ): number => x, 2.0, 1.5 ); // $ExpectError
40
-
41
- new Triangular( 1.0, true, 1.5 ); // $ExpectError
42
- new Triangular( 1.0, false, 1.5 ); // $ExpectError
43
- new Triangular( 1.0, '5', 1.5 ); // $ExpectError
44
- new Triangular( 1.0, [], 1.5 ); // $ExpectError
45
- new Triangular( 1.0, {}, 1.5 ); // $ExpectError
46
- new Triangular( 1.0, ( x: number ): number => x, 1.5 ); // $ExpectError
47
-
48
- new Triangular( 1.0, 2.0, true ); // $ExpectError
49
- new Triangular( 1.0, 2.0, false ); // $ExpectError
50
- new Triangular( 1.0, 2.0, '5' ); // $ExpectError
51
- new Triangular( 1.0, 2.0, [] ); // $ExpectError
52
- new Triangular( 1.0, 2.0, {} ); // $ExpectError
53
- new Triangular( 1.0, 2.0, ( x: number ): number => x ); // $ExpectError
54
- }
55
-
56
- // The compiler throws an error if the function is provided an unsupported number of arguments...
57
- {
58
- new Triangular( 0.0 ); // $ExpectError
59
- new Triangular( 0.0, 2.0 ); // $ExpectError
60
- new Triangular( 0.0, 2.0, 1.5, 1.5 ); // $ExpectError
61
- }
File without changes