You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Licensed under the Apache License, Version 2.0 (the "License");
248
+
* you may not use this file except in compliance with the License.
249
+
* You may obtain a copy of the License at
250
+
*
251
+
* http://www.apache.org/licenses/LICENSE-2.0
252
+
*
253
+
* Unless required by applicable law or agreed to in writing, software
254
+
* distributed under the License is distributed on an "AS IS" BASIS,
255
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
256
+
* See the License for the specific language governing permissions and
257
+
* limitations under the License.
258
+
*
259
+
*
260
+
* ## Notice
261
+
*
262
+
* The code is adapted from the Fortran routine from the FNLIB library of the [SLATEC Common Mathematical Library]{@link http://www.netlib.no/netlib/slatec/fnlib/}.
263
+
*
264
+
* The original code was developed by W. Fullerton of Los Alamos Scientific Laboratory, a governmental institution, and is therefore public domain.
265
+
*/
266
+
267
+
'use strict';
268
+
269
+
// VARIABLES //
270
+
271
+
var ALGMCS = [
272
+
+0.1276642195630062933333333333333e-30,
273
+
-0.3401102254316748799999999999999e-29,
274
+
+0.1025680058010470912000000000000e-27,
275
+
-0.3547598158101070547199999999999e-26,
276
+
+0.1429227355942498147573333333333e-24,
277
+
-0.6831888753985766870111999999999e-23,
278
+
+0.3962837061046434803679306666666e-21,
279
+
-0.2868042435334643284144622399999e-19,
280
+
+0.2683181998482698748957538846666e-17,
281
+
-0.3399615005417721944303330599666e-15,
282
+
+0.6221098041892605227126015543416e-13,
283
+
-0.1809129475572494194263306266719e-10,
284
+
+0.9810825646924729426157171547487e-8,
285
+
-0.1384948176067563840732986059135e-4,
286
+
+0.1666389480451863247205729650822e+0
287
+
];
288
+
var LEN = ALGMCS.length;
289
+
290
+
291
+
// MAIN //
292
+
293
+
/**
294
+
* Evaluate the n-term Chebyshev series at `x`.
295
+
*
296
+
* ## References
297
+
*
298
+
* - Broucke, Roger. 1973. "Algorithm: Ten Subroutines for the Manipulation of Chebyshev Series." _Communications of the ACM_ 16 (4). New York, NY, USA: ACM: 254–56. doi:[10.1145/362003.362037](https://doi.org/10.1145/362003.362037).
299
+
* - Fox, Leslie, and Ian Bax Parker. 1968. _Chebyshev polynomials in numerical analysis_. Oxford Mathematical Handbooks. London, United Kingdom: Oxford University Press. <https://books.google.com/books?id=F8NzsEtJCD0C>.
300
+
*
301
+
* @private
302
+
* @param {number} x - value at which the series is to be evaluated
303
+
* @returns {number} series value
304
+
*/
305
+
function dcseval( x ) {
306
+
var twox;
307
+
var b2;
308
+
var b1;
309
+
var b0;
310
+
var i;
311
+
312
+
if ( x < -1.1 || x > 1.1 ) {
313
+
return NaN;
314
+
}
315
+
b1 = 0.0;
316
+
b0 = 0.0;
317
+
twox = 2.0 * x;
318
+
for ( i = 0; i < LEN; i++ ) {
319
+
b2 = b1;
320
+
b1 = b0;
321
+
b0 = (twox*b1) - b2 + ALGMCS[ i ];
322
+
}
323
+
return ( b0-b2 ) * 0.5;
324
+
}
325
+
326
+
327
+
// EXPORTS //
328
+
329
+
module.exports = dcseval;
330
+
</pre></td></tr></table></pre>
331
+
332
+
<divclass='push'></div><!-- for sticky footer -->
333
+
</div><!-- /wrapper -->
334
+
<divclass='footer quiet pad2 space-top1 center small'>
0 commit comments