Skip to content

Commit edf2716

Browse files
authored
docs: update copy
Signed-off-by: Athan <kgryte@gmail.com>
1 parent d3645c6 commit edf2716

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

  • lib/node_modules/@stdlib/math/base/tools/chebyshev-series

lib/node_modules/@stdlib/math/base/tools/chebyshev-series/README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ var v = chebyshevSeries( 1.0, [ 1.0, 0.5 ] );
6262
// returns 0.75
6363
```
6464

65-
The input `x` is expected to lie in the interval `[-2, 2]`. The function internally evaluates Chebyshev polynomials at `x/2`.
66-
67-
The coefficients `c` should be ordered in **descending** degree.
68-
6965
#### chebyshevSeries.factory( c )
7066

7167
Uses code generation to in-line coefficients and return a function for evaluating a [Chebyshev series][chebyshev-series] using double-precision floating-point arithmetic.
@@ -86,6 +82,9 @@ var v = evaluate( 1.0 );
8682

8783
## Notes
8884

85+
- The value at which to evaluate a Chebyshev series is expected to reside on the interval `[-2, 2]`.
86+
- The function evaluates Chebyshev polynomials at `x/2`.
87+
- The coefficients `c` **must be** be ordered in **descending** degree.
8988
- For hot code paths in which coefficients are invariant, a compiled function will be more performant than `chebyshevSeries()`.
9089
- While code generation can boost performance, its use may be problematic in browser contexts enforcing a strict [content security policy][mdn-csp] (CSP). If running in or targeting an environment with a CSP, avoid using code generation.
9190

@@ -101,25 +100,23 @@ var v = evaluate( 1.0 );
101100

102101
```javascript
103102
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
104-
var runiform = require( '@stdlib/random/array/uniform' );
105-
var uniform = require( '@stdlib/random/base/uniform' );
103+
var uniform = require( '@stdlib/random/array/uniform' );
106104
var logEachMap = require( '@stdlib/console/log-each-map' );
107105
var chebyshevSeries = require( '@stdlib/math/base/tools/chebyshev-series' );
108106

109107
// Create an array of random coefficients:
110108
var coef = discreteUniform( 10, -100, 100 );
111109

112110
// Evaluate the series at random values using the direct function:
113-
var v;
111+
var v = uniform( 100, -2.0, 2.0 );
114112
var i;
115-
for ( i = 0; i < 100; i++ ) {
116-
v = uniform( -2.0, 2.0 );
117-
console.log( 'f(%d) = %d', v, chebyshevSeries( v, coef ) );
113+
for ( i = 0; i < v.length; i++ ) {
114+
console.log( 'f(%d) = %d', v[ i ], chebyshevSeries( v[ i ], coef ) );
118115
}
119116

120117
// Generate a chebyshev series evaluation function:
121118
var evaluate = chebyshevSeries.factory( coef );
122-
var x = runiform( 100, -2.0, 2.0 );
119+
var x = uniform( 100, -2.0, 2.0 );
123120
logEachMap( 'f(%d) = %d', x, evaluate );
124121
```
125122

0 commit comments

Comments
 (0)