@stdlib/math-base-tools 0.2.1 → 0.4.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/NOTICE +1 -1
- package/README.md +17 -8
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/docs/types/index.d.ts +103 -9
- package/lib/index.js +27 -0
- package/package.json +13 -10
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -67,12 +67,15 @@ var o = tools;
|
|
|
67
67
|
<div class="namespace-toc">
|
|
68
68
|
|
|
69
69
|
- <span class="signature">[`continuedFraction( generator[, options ] )`][@stdlib/math/base/tools/continued-fraction]</span><span class="delimiter">: </span><span class="description">continued fraction approximation.</span>
|
|
70
|
-
- <span class="signature">[`evalpoly( c, x )`][@stdlib/math/base/tools/evalpoly]</span><span class="delimiter">: </span><span class="description">evaluate a polynomial.</span>
|
|
71
|
-
- <span class="signature">[`
|
|
70
|
+
- <span class="signature">[`evalpoly( c, x )`][@stdlib/math/base/tools/evalpoly]</span><span class="delimiter">: </span><span class="description">evaluate a polynomial using double-precision floating-point arithmetic.</span>
|
|
71
|
+
- <span class="signature">[`evalpolyf( c, x )`][@stdlib/math/base/tools/evalpolyf]</span><span class="delimiter">: </span><span class="description">evaluate a polynomial using single-precision floating-point arithmetic.</span>
|
|
72
|
+
- <span class="signature">[`evalrational( P, Q, x )`][@stdlib/math/base/tools/evalrational]</span><span class="delimiter">: </span><span class="description">evaluate a rational function using double-precision floating-point arithmetic.</span>
|
|
73
|
+
- <span class="signature">[`evalrationalf( P, Q, x )`][@stdlib/math/base/tools/evalrationalf]</span><span class="delimiter">: </span><span class="description">evaluate a rational function using single-precision floating-point arithmetic.</span>
|
|
72
74
|
- <span class="signature">[`fibpoly( n, x )`][@stdlib/math/base/tools/fibpoly]</span><span class="delimiter">: </span><span class="description">evaluate a Fibonacci polynomial.</span>
|
|
73
75
|
- <span class="signature">[`hermitepoly( n, x )`][@stdlib/math/base/tools/hermitepoly]</span><span class="delimiter">: </span><span class="description">evaluate a physicist's Hermite polynomial.</span>
|
|
74
76
|
- <span class="signature">[`lucaspoly( n, x )`][@stdlib/math/base/tools/lucaspoly]</span><span class="delimiter">: </span><span class="description">evaluate a Lucas polynomial.</span>
|
|
75
|
-
- <span class="signature">[`normhermitepoly( n, x )`][@stdlib/math/base/tools/normhermitepoly]</span><span class="delimiter">: </span><span class="description">evaluate a normalized Hermite polynomial.</span>
|
|
77
|
+
- <span class="signature">[`normhermitepoly( n, x )`][@stdlib/math/base/tools/normhermitepoly]</span><span class="delimiter">: </span><span class="description">evaluate a normalized Hermite polynomial using double-precision floating-point arithmetic.</span>
|
|
78
|
+
- <span class="signature">[`normhermitepolyf( n, x )`][@stdlib/math/base/tools/normhermitepolyf]</span><span class="delimiter">: </span><span class="description">evaluate a normalized Hermite polynomial using single-precision floating-point arithmetic.</span>
|
|
76
79
|
- <span class="signature">[`sumSeries( generator[, options ] )`][@stdlib/math/base/tools/sum-series]</span><span class="delimiter">: </span><span class="description">compute the sum of an infinite series.</span>
|
|
77
80
|
|
|
78
81
|
</div>
|
|
@@ -136,7 +139,7 @@ See [LICENSE][stdlib-license].
|
|
|
136
139
|
|
|
137
140
|
## Copyright
|
|
138
141
|
|
|
139
|
-
Copyright © 2016-
|
|
142
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
140
143
|
|
|
141
144
|
</section>
|
|
142
145
|
|
|
@@ -149,8 +152,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
149
152
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-tools.svg
|
|
150
153
|
[npm-url]: https://npmjs.org/package/@stdlib/math-base-tools
|
|
151
154
|
|
|
152
|
-
[test-image]: https://github.com/stdlib-js/math-base-tools/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
153
|
-
[test-url]: https://github.com/stdlib-js/math-base-tools/actions/workflows/test.yml?query=branch:v0.
|
|
155
|
+
[test-image]: https://github.com/stdlib-js/math-base-tools/actions/workflows/test.yml/badge.svg?branch=v0.4.0
|
|
156
|
+
[test-url]: https://github.com/stdlib-js/math-base-tools/actions/workflows/test.yml?query=branch:v0.4.0
|
|
154
157
|
|
|
155
158
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-tools/main.svg
|
|
156
159
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-base-tools?branch=main
|
|
@@ -162,8 +165,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
162
165
|
|
|
163
166
|
-->
|
|
164
167
|
|
|
165
|
-
[chat-image]: https://img.shields.io/
|
|
166
|
-
[chat-url]: https://
|
|
168
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
169
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
167
170
|
|
|
168
171
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
169
172
|
|
|
@@ -188,8 +191,12 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
188
191
|
|
|
189
192
|
[@stdlib/math/base/tools/evalpoly]: https://www.npmjs.com/package/@stdlib/math-base-tools-evalpoly
|
|
190
193
|
|
|
194
|
+
[@stdlib/math/base/tools/evalpolyf]: https://www.npmjs.com/package/@stdlib/math-base-tools-evalpolyf
|
|
195
|
+
|
|
191
196
|
[@stdlib/math/base/tools/evalrational]: https://www.npmjs.com/package/@stdlib/math-base-tools-evalrational
|
|
192
197
|
|
|
198
|
+
[@stdlib/math/base/tools/evalrationalf]: https://www.npmjs.com/package/@stdlib/math-base-tools-evalrationalf
|
|
199
|
+
|
|
193
200
|
[@stdlib/math/base/tools/fibpoly]: https://www.npmjs.com/package/@stdlib/math-base-tools-fibpoly
|
|
194
201
|
|
|
195
202
|
[@stdlib/math/base/tools/hermitepoly]: https://www.npmjs.com/package/@stdlib/math-base-tools-hermitepoly
|
|
@@ -198,6 +205,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
198
205
|
|
|
199
206
|
[@stdlib/math/base/tools/normhermitepoly]: https://www.npmjs.com/package/@stdlib/math-base-tools-normhermitepoly
|
|
200
207
|
|
|
208
|
+
[@stdlib/math/base/tools/normhermitepolyf]: https://www.npmjs.com/package/@stdlib/math-base-tools-normhermitepolyf
|
|
209
|
+
|
|
201
210
|
[@stdlib/math/base/tools/sum-series]: https://www.npmjs.com/package/@stdlib/math-base-tools-sum-series
|
|
202
211
|
|
|
203
212
|
<!-- </toc-links> -->
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var r=require('@stdlib/utils-define-read-only-property/dist'),e={};r(e,"continuedFraction",require('@stdlib/math-base-tools-continued-fraction/dist'));r(e,"evalpoly",require('@stdlib/math-base-tools-evalpoly/dist'));r(e,"evalrational",require('@stdlib/math-base-tools-evalrational/dist'));r(e,"fibpoly",require('@stdlib/math-base-tools-fibpoly/dist'));r(e,"hermitepoly",require('@stdlib/math-base-tools-hermitepoly/dist'));r(e,"lucaspoly",require('@stdlib/math-base-tools-lucaspoly/dist'));r(e,"normhermitepoly",require('@stdlib/math-base-tools-normhermitepoly/dist'));r(e,"sumSeries",require('@stdlib/math-base-tools-sum-series/dist'));module.exports=e;
|
|
1
|
+
"use strict";var r=require('@stdlib/utils-define-read-only-property/dist'),e={};r(e,"continuedFraction",require('@stdlib/math-base-tools-continued-fraction/dist'));r(e,"evalpoly",require('@stdlib/math-base-tools-evalpoly/dist'));r(e,"evalpolyf",require('@stdlib/math-base-tools-evalpolyf/dist'));r(e,"evalrational",require('@stdlib/math-base-tools-evalrational/dist'));r(e,"evalrationalf",require('@stdlib/math-base-tools-evalrationalf/dist'));r(e,"fibpoly",require('@stdlib/math-base-tools-fibpoly/dist'));r(e,"hermitepoly",require('@stdlib/math-base-tools-hermitepoly/dist'));r(e,"lucaspoly",require('@stdlib/math-base-tools-lucaspoly/dist'));r(e,"normhermitepoly",require('@stdlib/math-base-tools-normhermitepoly/dist'));r(e,"normhermitepolyf",require('@stdlib/math-base-tools-normhermitepolyf/dist'));r(e,"sumSeries",require('@stdlib/math-base-tools-sum-series/dist'));module.exports=e;
|
|
2
2
|
/** @license Apache-2.0 */
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../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'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n/*\n* The following modules are intentionally not exported: evalpoly-compile, evalpoly-compile-c, evalrational-compile, evalrational-compile-c\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name continuedFraction\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/continued-fraction}\n*/\nsetReadOnly( ns, 'continuedFraction', require( '@stdlib/math-base-tools-continued-fraction' ) );\n\n/**\n* @name evalpoly\n* @memberof tools\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/evalpoly}\n*/\nsetReadOnly( ns, 'evalpoly', require( '@stdlib/math-base-tools-evalpoly' ) );\n\n/**\n* @name evalrational\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/evalrational}\n*/\nsetReadOnly( ns, 'evalrational', require( '@stdlib/math-base-tools-evalrational' ) );\n\n/**\n* @name fibpoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/fibpoly}\n*/\nsetReadOnly( ns, 'fibpoly', require( '@stdlib/math-base-tools-fibpoly' ) );\n\n/**\n* @name hermitepoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/hermitepoly}\n*/\nsetReadOnly( ns, 'hermitepoly', require( '@stdlib/math-base-tools-hermitepoly' ) );\n\n/**\n* @name lucaspoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/lucaspoly}\n*/\nsetReadOnly( ns, 'lucaspoly', require( '@stdlib/math-base-tools-lucaspoly' ) );\n\n/**\n* @name normhermitepoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/normhermitepoly}\n*/\nsetReadOnly( ns, 'normhermitepoly', require( '@stdlib/math-base-tools-normhermitepoly' ) );\n\n/**\n* @name sumSeries\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/sum-series}\n*/\nsetReadOnly( ns, 'sumSeries', require( '@stdlib/math-base-tools-sum-series' ) );\n\n\n// EXPORTS //\n\nmodule.exports = ns;\n"],
|
|
5
|
-
"mappings": "aA8BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAK,CAAC,EASVD,EAAaC,EAAI,oBAAqB,QAAS,4CAA6C,CAAE,EAS9FD,EAAaC,EAAI,WAAY,QAAS,kCAAmC,CAAE,EAS3ED,EAAaC,EAAI,eAAgB,QAAS,sCAAuC,CAAE,EASnFD,EAAaC,EAAI,UAAW,QAAS,iCAAkC,CAAE,EASzED,EAAaC,EAAI,cAAe,QAAS,qCAAsC,CAAE,EASjFD,EAAaC,EAAI,YAAa,QAAS,mCAAoC,CAAE,EAS7ED,EAAaC,EAAI,kBAAmB,QAAS,yCAA0C,CAAE,EASzFD,EAAaC,EAAI,YAAa,QAAS,oCAAqC,CAAE,EAK9E,OAAO,QAAUA",
|
|
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'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n/*\n* The following modules are intentionally not exported: evalpoly-compile, evalpoly-compile-c, evalrational-compile, evalrational-compile-c\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name continuedFraction\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/continued-fraction}\n*/\nsetReadOnly( ns, 'continuedFraction', require( '@stdlib/math-base-tools-continued-fraction' ) );\n\n/**\n* @name evalpoly\n* @memberof tools\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/evalpoly}\n*/\nsetReadOnly( ns, 'evalpoly', require( '@stdlib/math-base-tools-evalpoly' ) );\n\n/**\n* @name evalpolyf\n* @memberof tools\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/evalpolyf}\n*/\nsetReadOnly( ns, 'evalpolyf', require( '@stdlib/math-base-tools-evalpolyf' ) );\n\n/**\n* @name evalrational\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/evalrational}\n*/\nsetReadOnly( ns, 'evalrational', require( '@stdlib/math-base-tools-evalrational' ) );\n\n/**\n* @name evalrationalf\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/evalrationalf}\n*/\nsetReadOnly( ns, 'evalrationalf', require( '@stdlib/math-base-tools-evalrationalf' ) );\n\n/**\n* @name fibpoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/fibpoly}\n*/\nsetReadOnly( ns, 'fibpoly', require( '@stdlib/math-base-tools-fibpoly' ) );\n\n/**\n* @name hermitepoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/hermitepoly}\n*/\nsetReadOnly( ns, 'hermitepoly', require( '@stdlib/math-base-tools-hermitepoly' ) );\n\n/**\n* @name lucaspoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/lucaspoly}\n*/\nsetReadOnly( ns, 'lucaspoly', require( '@stdlib/math-base-tools-lucaspoly' ) );\n\n/**\n* @name normhermitepoly\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/normhermitepoly}\n*/\nsetReadOnly( ns, 'normhermitepoly', require( '@stdlib/math-base-tools-normhermitepoly' ) );\n\n/**\n* @name normhermitepolyf\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/normhermitepolyf}\n*/\nsetReadOnly( ns, 'normhermitepolyf', require( '@stdlib/math-base-tools-normhermitepolyf' ) );\n\n/**\n* @name sumSeries\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/math/base/tools/sum-series}\n*/\nsetReadOnly( ns, 'sumSeries', require( '@stdlib/math-base-tools-sum-series' ) );\n\n\n// EXPORTS //\n\nmodule.exports = ns;\n"],
|
|
5
|
+
"mappings": "aA8BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAK,CAAC,EASVD,EAAaC,EAAI,oBAAqB,QAAS,4CAA6C,CAAE,EAS9FD,EAAaC,EAAI,WAAY,QAAS,kCAAmC,CAAE,EAS3ED,EAAaC,EAAI,YAAa,QAAS,mCAAoC,CAAE,EAS7ED,EAAaC,EAAI,eAAgB,QAAS,sCAAuC,CAAE,EASnFD,EAAaC,EAAI,gBAAiB,QAAS,uCAAwC,CAAE,EASrFD,EAAaC,EAAI,UAAW,QAAS,iCAAkC,CAAE,EASzED,EAAaC,EAAI,cAAe,QAAS,qCAAsC,CAAE,EASjFD,EAAaC,EAAI,YAAa,QAAS,mCAAoC,CAAE,EAS7ED,EAAaC,EAAI,kBAAmB,QAAS,yCAA0C,CAAE,EASzFD,EAAaC,EAAI,mBAAoB,QAAS,0CAA2C,CAAE,EAS3FD,EAAaC,EAAI,YAAa,QAAS,oCAAqC,CAAE,EAK9E,OAAO,QAAUA",
|
|
6
6
|
"names": ["setReadOnly", "ns"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -22,11 +22,14 @@
|
|
|
22
22
|
|
|
23
23
|
import continuedFraction = require( '@stdlib/math-base-tools-continued-fraction' );
|
|
24
24
|
import evalpoly = require( '@stdlib/math-base-tools-evalpoly' );
|
|
25
|
+
import evalpolyf = require( '@stdlib/math-base-tools-evalpolyf' );
|
|
25
26
|
import evalrational = require( '@stdlib/math-base-tools-evalrational' );
|
|
27
|
+
import evalrationalf = require( '@stdlib/math-base-tools-evalrationalf' );
|
|
26
28
|
import fibpoly = require( '@stdlib/math-base-tools-fibpoly' );
|
|
27
29
|
import hermitepoly = require( '@stdlib/math-base-tools-hermitepoly' );
|
|
28
30
|
import lucaspoly = require( '@stdlib/math-base-tools-lucaspoly' );
|
|
29
31
|
import normhermitepoly = require( '@stdlib/math-base-tools-normhermitepoly' );
|
|
32
|
+
import normhermitepolyf = require( '@stdlib/math-base-tools-normhermitepolyf' );
|
|
30
33
|
import sumSeries = require( '@stdlib/math-base-tools-sum-series' );
|
|
31
34
|
|
|
32
35
|
/**
|
|
@@ -64,7 +67,7 @@ interface Namespace {
|
|
|
64
67
|
continuedFraction: typeof continuedFraction;
|
|
65
68
|
|
|
66
69
|
/**
|
|
67
|
-
* Evaluates a polynomial.
|
|
70
|
+
* Evaluates a polynomial using double-precision floating-point arithmetic.
|
|
68
71
|
*
|
|
69
72
|
* ## Notes
|
|
70
73
|
*
|
|
@@ -78,11 +81,11 @@ interface Namespace {
|
|
|
78
81
|
* @returns evaluated polynomial
|
|
79
82
|
*
|
|
80
83
|
* @example
|
|
81
|
-
* var v = ns.evalpoly( [3.0,2.0,1.0], 10.0 ); // 3*10^0 + 2*10^1 + 1*10^2
|
|
84
|
+
* var v = ns.evalpoly( [ 3.0, 2.0, 1.0 ], 10.0 ); // 3*10^0 + 2*10^1 + 1*10^2
|
|
82
85
|
* // returns 123.0
|
|
83
86
|
*
|
|
84
87
|
* @example
|
|
85
|
-
* var polyval = ns.evalpoly.factory( [3.0,2.0,1.0] );
|
|
88
|
+
* var polyval = ns.evalpoly.factory( [ 3.0, 2.0, 1.0 ] );
|
|
86
89
|
*
|
|
87
90
|
* var v = polyval( 10.0 ); // => 3*10^0 + 2*10^1 + 1*10^2
|
|
88
91
|
* // returns 123.0
|
|
@@ -93,16 +96,48 @@ interface Namespace {
|
|
|
93
96
|
evalpoly: typeof evalpoly;
|
|
94
97
|
|
|
95
98
|
/**
|
|
96
|
-
* Evaluates a
|
|
99
|
+
* Evaluates a polynomial using single-precision floating-point arithmetic.
|
|
97
100
|
*
|
|
98
101
|
* ## Notes
|
|
99
102
|
*
|
|
100
|
-
* - Coefficients should be sorted in ascending degree.
|
|
101
103
|
* - The implementation uses [Horner's rule][horners-method] for efficient computation.
|
|
102
104
|
*
|
|
103
105
|
* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
|
|
104
106
|
*
|
|
105
107
|
*
|
|
108
|
+
* @param c - polynomial coefficients sorted in ascending degree
|
|
109
|
+
* @param x - value at which to evaluate the polynomial
|
|
110
|
+
* @returns evaluated polynomial
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* var Float32Array = require( '@stdlib/array-float32' );
|
|
114
|
+
*
|
|
115
|
+
* var v = ns.evalpolyf( new Float32Array( [ 3.0, 2.0, 1.0 ] ), 10.0 ); // 3*10^0 + 2*10^1 + 1*10^2
|
|
116
|
+
* // returns 123.0
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* var Float32Array = require( '@stdlib/array-float32' );
|
|
120
|
+
*
|
|
121
|
+
* var polyval = ns.evalpolyf.factory( new Float32Array( [ 3.0, 2.0, 1.0 ] ) );
|
|
122
|
+
*
|
|
123
|
+
* var v = polyval( 10.0 ); // => 3*10^0 + 2*10^1 + 1*10^2
|
|
124
|
+
* // returns 123.0
|
|
125
|
+
*
|
|
126
|
+
* v = polyval( 5.0 ); // => 3*5^0 + 2*5^1 + 1*5^2
|
|
127
|
+
* // returns 38.0
|
|
128
|
+
*/
|
|
129
|
+
evalpolyf: typeof evalpolyf;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)) using double-precision floating-point arithmetic.
|
|
133
|
+
*
|
|
134
|
+
* ## Notes
|
|
135
|
+
*
|
|
136
|
+
* - Coefficients should be sorted in ascending degree.
|
|
137
|
+
* - The implementation uses [Horner's rule][horners-method] for efficient computation.
|
|
138
|
+
*
|
|
139
|
+
* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
|
|
140
|
+
*
|
|
106
141
|
* @param P - numerator polynomial coefficients sorted in ascending degree
|
|
107
142
|
* @param Q - denominator polynomial coefficients sorted in ascending degree
|
|
108
143
|
* @param x - value at which to evaluate the rational function
|
|
@@ -129,6 +164,46 @@ interface Namespace {
|
|
|
129
164
|
*/
|
|
130
165
|
evalrational: typeof evalrational;
|
|
131
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)) using single-precision floating-point arithmetic.
|
|
169
|
+
*
|
|
170
|
+
* ## Notes
|
|
171
|
+
*
|
|
172
|
+
* - Coefficients should be sorted in ascending degree.
|
|
173
|
+
* - The implementation uses [Horner's rule][horners-method] for efficient computation.
|
|
174
|
+
*
|
|
175
|
+
* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
|
|
176
|
+
*
|
|
177
|
+
* @param P - numerator polynomial coefficients sorted in ascending degree
|
|
178
|
+
* @param Q - denominator polynomial coefficients sorted in ascending degree
|
|
179
|
+
* @param x - value at which to evaluate the rational function
|
|
180
|
+
* @returns evaluated rational function
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* var Float32Array = require( '@stdlib/array-float32' );
|
|
184
|
+
*
|
|
185
|
+
* var P = new Float32Array( [ -6.0, -5.0 ] );
|
|
186
|
+
* var Q = new Float32Array( [ 3.0, 0.5 ] );
|
|
187
|
+
*
|
|
188
|
+
* var v = ns.evalrationalf( P, Q, 6.0 ); // => ( -6*6^0 - 5*6^1 ) / ( 3*6^0 + 0.5*6^1 ) = (-6-30)/(3+3)
|
|
189
|
+
* // returns -6.0
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* var Float32Array = require( '@stdlib/array-float32' );
|
|
193
|
+
*
|
|
194
|
+
* var P = new Float32Array( [ 20.0, 8.0, 3.0 ] );
|
|
195
|
+
* var Q = new Float32Array( [ 10.0, 9.0, 1.0 ] );
|
|
196
|
+
*
|
|
197
|
+
* var rational = ns.evalrationalf.factory( P, Q );
|
|
198
|
+
*
|
|
199
|
+
* var v = rational( 10.0 ); // => (20*10^0 + 8*10^1 + 3*10^2) / (10*10^0 + 9*10^1 + 1*10^2) = (20+80+300)/(10+90+100)
|
|
200
|
+
* // returns 2.0
|
|
201
|
+
*
|
|
202
|
+
* v = rational( 2.0 ); // => (20*2^0 + 8*2^1 + 3*2^2) / (10*2^0 + 9*2^1 + 1*2^2) = (20+16+12)/(10+18+4)
|
|
203
|
+
* // returns 1.5
|
|
204
|
+
*/
|
|
205
|
+
evalrationalf: typeof evalrationalf;
|
|
206
|
+
|
|
132
207
|
/**
|
|
133
208
|
* Evaluates a Fibonacci polynomial.
|
|
134
209
|
*
|
|
@@ -141,12 +216,12 @@ interface Namespace {
|
|
|
141
216
|
* // returns 5.0
|
|
142
217
|
*
|
|
143
218
|
* @example
|
|
144
|
-
* var
|
|
219
|
+
* var fibpolyval = ns.fibpoly.factory( 5 );
|
|
145
220
|
*
|
|
146
|
-
* var v =
|
|
221
|
+
* var v = fibpolyval( 1.0 );
|
|
147
222
|
* // returns 5.0
|
|
148
223
|
*
|
|
149
|
-
* v =
|
|
224
|
+
* v = fibpolyval( 2.0 );
|
|
150
225
|
* // returns 29.0
|
|
151
226
|
*/
|
|
152
227
|
fibpoly: typeof fibpoly;
|
|
@@ -197,7 +272,7 @@ interface Namespace {
|
|
|
197
272
|
lucaspoly: typeof lucaspoly;
|
|
198
273
|
|
|
199
274
|
/**
|
|
200
|
-
* Evaluates a normalized Hermite polynomial.
|
|
275
|
+
* Evaluates a normalized Hermite polynomial using double-precision floating-point arithmetic.
|
|
201
276
|
*
|
|
202
277
|
* @param n - nonnegative polynomial degree
|
|
203
278
|
* @param x - evaluation point
|
|
@@ -215,6 +290,25 @@ interface Namespace {
|
|
|
215
290
|
*/
|
|
216
291
|
normhermitepoly: typeof normhermitepoly;
|
|
217
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Evaluates a normalized Hermite polynomial using single-precision floating-point arithmetic.
|
|
295
|
+
*
|
|
296
|
+
* @param n - nonnegative polynomial degree
|
|
297
|
+
* @param x - evaluation point
|
|
298
|
+
* @returns function value
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* var v = ns.normhermitepolyf( 1, 0.5 );
|
|
302
|
+
* // returns 0.5
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* var polyval = ns.normhermitepolyf.factory( 2 );
|
|
306
|
+
*
|
|
307
|
+
* var v = polyval( 0.5 );
|
|
308
|
+
* // returns -0.75
|
|
309
|
+
*/
|
|
310
|
+
normhermitepolyf: typeof normhermitepolyf;
|
|
311
|
+
|
|
218
312
|
/**
|
|
219
313
|
* Sum the elements of the series given by the supplied function.
|
|
220
314
|
*
|
package/lib/index.js
CHANGED
|
@@ -58,6 +58,15 @@ setReadOnly( ns, 'continuedFraction', require( '@stdlib/math-base-tools-continue
|
|
|
58
58
|
*/
|
|
59
59
|
setReadOnly( ns, 'evalpoly', require( '@stdlib/math-base-tools-evalpoly' ) );
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @name evalpolyf
|
|
63
|
+
* @memberof tools
|
|
64
|
+
* @readonly
|
|
65
|
+
* @type {Function}
|
|
66
|
+
* @see {@link module:@stdlib/math/base/tools/evalpolyf}
|
|
67
|
+
*/
|
|
68
|
+
setReadOnly( ns, 'evalpolyf', require( '@stdlib/math-base-tools-evalpolyf' ) );
|
|
69
|
+
|
|
61
70
|
/**
|
|
62
71
|
* @name evalrational
|
|
63
72
|
* @memberof ns
|
|
@@ -67,6 +76,15 @@ setReadOnly( ns, 'evalpoly', require( '@stdlib/math-base-tools-evalpoly' ) );
|
|
|
67
76
|
*/
|
|
68
77
|
setReadOnly( ns, 'evalrational', require( '@stdlib/math-base-tools-evalrational' ) );
|
|
69
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @name evalrationalf
|
|
81
|
+
* @memberof ns
|
|
82
|
+
* @readonly
|
|
83
|
+
* @type {Function}
|
|
84
|
+
* @see {@link module:@stdlib/math/base/tools/evalrationalf}
|
|
85
|
+
*/
|
|
86
|
+
setReadOnly( ns, 'evalrationalf', require( '@stdlib/math-base-tools-evalrationalf' ) );
|
|
87
|
+
|
|
70
88
|
/**
|
|
71
89
|
* @name fibpoly
|
|
72
90
|
* @memberof ns
|
|
@@ -103,6 +121,15 @@ setReadOnly( ns, 'lucaspoly', require( '@stdlib/math-base-tools-lucaspoly' ) );
|
|
|
103
121
|
*/
|
|
104
122
|
setReadOnly( ns, 'normhermitepoly', require( '@stdlib/math-base-tools-normhermitepoly' ) );
|
|
105
123
|
|
|
124
|
+
/**
|
|
125
|
+
* @name normhermitepolyf
|
|
126
|
+
* @memberof ns
|
|
127
|
+
* @readonly
|
|
128
|
+
* @type {Function}
|
|
129
|
+
* @see {@link module:@stdlib/math/base/tools/normhermitepolyf}
|
|
130
|
+
*/
|
|
131
|
+
setReadOnly( ns, 'normhermitepolyf', require( '@stdlib/math-base-tools-normhermitepolyf' ) );
|
|
132
|
+
|
|
106
133
|
/**
|
|
107
134
|
* @name sumSeries
|
|
108
135
|
* @memberof ns
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-base-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Base math tools.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -30,15 +30,18 @@
|
|
|
30
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stdlib/math-base-tools-continued-fraction": "^0.2.
|
|
34
|
-
"@stdlib/math-base-tools-evalpoly": "^0.2.
|
|
35
|
-
"@stdlib/math-base-tools-
|
|
36
|
-
"@stdlib/math-base-tools-
|
|
37
|
-
"@stdlib/math-base-tools-
|
|
38
|
-
"@stdlib/math-base-tools-
|
|
39
|
-
"@stdlib/math-base-tools-
|
|
40
|
-
"@stdlib/math-base-tools-
|
|
41
|
-
"@stdlib/
|
|
33
|
+
"@stdlib/math-base-tools-continued-fraction": "^0.2.2",
|
|
34
|
+
"@stdlib/math-base-tools-evalpoly": "^0.2.2",
|
|
35
|
+
"@stdlib/math-base-tools-evalpolyf": "^0.1.1",
|
|
36
|
+
"@stdlib/math-base-tools-evalrational": "^0.2.2",
|
|
37
|
+
"@stdlib/math-base-tools-evalrationalf": "^0.1.1",
|
|
38
|
+
"@stdlib/math-base-tools-fibpoly": "^0.2.2",
|
|
39
|
+
"@stdlib/math-base-tools-hermitepoly": "^0.2.2",
|
|
40
|
+
"@stdlib/math-base-tools-lucaspoly": "^0.2.2",
|
|
41
|
+
"@stdlib/math-base-tools-normhermitepoly": "^0.2.2",
|
|
42
|
+
"@stdlib/math-base-tools-normhermitepolyf": "^0.0.2",
|
|
43
|
+
"@stdlib/math-base-tools-sum-series": "^0.2.2",
|
|
44
|
+
"@stdlib/utils-define-read-only-property": "^0.2.2"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {},
|
|
44
47
|
"engines": {
|