forked from johannesgerer/jburkardt-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chebyshev_polynomial.html
523 lines (480 loc) · 15.5 KB
/
chebyshev_polynomial.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
<html>
<head>
<title>
CHEBYSHEV_POLYNOMIAL - Chebyshev Polynomials
</title>
</head>
<body bgcolor="#eeeeee" link="#cc0000" alink="#ff3300" vlink="#000055">
<h1 align = "center">
CHEBYSHEV_POLYNOMIAL <br> Chebyshev Polynomials
</h1>
<hr>
<p>
<b>CHEBYSHEV_POLYNOMIAL</b>
is a C++ library which
considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x).
Functions are provided to evaluate the polynomials, determine their zeros,
produce their polynomial coefficients, produce related quadrature rules,
project other functions onto these polynomial bases, and integrate
double and triple products of the polynomials.
</p>
<p>
The Chebyshev polynomial T(n,x), or Chebyshev polynomial of the first kind,
may be defined, for 0 <= n, and -1 <= x <= +1 by:
<pre>
cos ( t ) = x
T(n,x) = cos ( n * t )
</pre>
For any value of x, T(n,x) may be evaluated by a three
term recurrence:
<pre>
T(0,x) = 1
T(1,x) = x
T(n+1,x) = 2x T(n,x) - T(n-1,x)
</pre>
</p>
<p>
The Chebyshev polynomial U(n,x), or Chebyshev polynomial of the second kind,
may be defined, for 0 <= n, and -1 <= x <= +1 by:
<pre>
cos ( t ) = x
U(n,x) = sin ( ( n + 1 ) t ) / sin ( t )
</pre>
For any value of x, U(n,x) may be evaluated by a three
term recurrence:
<pre>
U(0,x) = 1
U(1,x) = 2x
U(n+1,x) = 2x U(n,x) - U(n-1,x)
</pre>
</p>
<p>
The Chebyshev polynomial V(n,x), or Chebyshev polynomial of the third kind,
may be defined, for 0 <= n, and -1 <= x <= +1 by:
<pre>
cos ( t ) = x
V(n,x) = cos ( (2n+1)*t/2) / cos ( t/2)
</pre>
For any value of x, V(n,x) may be evaluated by a three
term recurrence:
<pre>
V(0,x) = 1
V(1,x) = 2x-1
V(n+1,x) = 2x V(n,x) - V(n-1,x)
</pre>
</p>
<p>
The Chebyshev polynomial W(n,x), or Chebyshev polynomial of the fourth kind,
may be defined, for 0 <= n, and -1 <= x <= +1 by:
<pre>
cos ( t ) = x
W(n,x) = sin((2*n+1)*t/2)/sin(t/2)
</pre>
For any value of x, W(n,x) may be evaluated by a three
term recurrence:
<pre>
W(0,x) = 1
W(1,x) = 2x+1
W(n+1,x) = 2x W(n,x) - W(n-1,x)
</pre>
</p>
<h3 align = "center">
Licensing:
</h3>
<p>
The computer code and data files described and made available on this
web page are distributed under
<a href = "../../txt/gnu_lgpl.txt">the GNU LGPL license.</a>
</p>
<h3 align = "center">
Languages:
</h3>
<p>
<b>CHEBYSHEV_POLYNOMIAL</b> is available in
<a href = "../../c_src/chebyshev_polynomial/chebyshev_polynomial.html">a C version</a> and
<a href = "../../cpp_src/chebyshev_polynomial/chebyshev_polynomial.html">a C++ version</a> and
<a href = "../../f77_src/chebyshev_polynomial/chebyshev_polynomial.html">a FORTRAN77 version</a> and
<a href = "../../f_src/chebyshev_polynomial/chebyshev_polynomial.html">a FORTRAN90 version</a> and
<a href = "../../m_src/chebyshev_polynomial/chebyshev_polynomial.html">a MATLAB version</a>.
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../cpp_src/bernstein_polynomial/bernstein_polynomial.html">
BERNSTEIN_POLYNOMIAL</a>,
a C++ library which
evaluates the Bernstein polynomials,
useful for uniform approximation of functions;
</p>
<p>
<a href = "../../cpp_src/chebyshev/chebyshev.html">
CHEBYSHEV</a>,
a C++ library which
computes the Chebyshev interpolant/approximant to a given function
over an interval.
</p>
<p>
<a href = "../../cpp_src/chebyshev_series/chebyshev_series.html">
CHEBYSHEV_SERIES</a>,
a C++ library which
can evaluate a Chebyshev series approximating a function f(x),
while efficiently computing one, two or three derivatives of the
series, which approximate f'(x), f''(x), and f'''(x),
by Manfred Zimmer.
</p>
<p>
<a href = "../../cpp_src/chebyshev1_rule/chebyshev1_rule.html">
CHEBYSHEV1_RULE</a>,
a C++ program which
computes and prints a Gauss-Chebyshev type 1 quadrature rule.
</p>
<p>
<a href = "../../cpp_src/chebyshev2_rule/chebyshev2_rule.html">
CHEBYSHEV2_RULE</a>,
a C++ program which
compute and print a Gauss-Chebyshev type 2 quadrature rule.
</p>
<p>
<a href = "../../cpp_src/hermite_polynomial/hermite_polynomial.html">
HERMITE_POLYNOMIAL</a>,
a C++ library which
evaluates the physicist's Hermite polynomial, the probabilist's Hermite polynomial,
the Hermite function, and related functions.
</p>
<p>
<a href = "../../cpp_src/int_exactness_chebyshev1/int_exactness_chebyshev1.html">
INT_EXACTNESS_CHEBYSHEV1</a>,
a C++ program which
tests the polynomial exactness of Gauss-Chebyshev type 1 quadrature rules.
</p>
<p>
<a href = "../../cpp_src/int_exactness_chebyshev2/int_exactness_chebyshev2.html">
INT_EXACTNESS_CHEBYSHEV2</a>,
a C++ program which
tests the polynomial exactness of Gauss-Chebyshev type 2 quadrature rules.
</p>
<p>
<a href = "../../cpp_src/jacobi_polynomial/jacobi_polynomial.html">
JACOBI_POLYNOMIAL</a>,
a C++ library which
evaluates the Jacobi polynomial and associated functions.
</p>
<p>
<a href = "../../cpp_src/laguerre_polynomial/laguerre_polynomial.html">
LAGUERRE_POLYNOMIAL</a>,
a C++ library which
evaluates the Laguerre polynomial, the generalized Laguerre polynomial,
and the Laguerre function.
</p>
<p>
<a href = "../../cpp_src/legendre_polynomial/legendre_polynomial.html">
LEGENDRE_POLYNOMIAL</a>,
a C++ library which
evaluates the Legendre polynomial and associated functions.
</p>
<p>
<a href = "../../cpp_src/lobatto_polynomial/lobatto_polynomial.html">
LOBATTO_POLYNOMIAL</a>,
a C++ library which
evaluates Lobatto polynomials, similar to Legendre polynomials
except that they are zero at both endpoints.
</p>
<p>
<a href = "../../cpp_src/polpak/polpak.html">
POLPAK</a>,
a C++ library which
evaluates a variety of mathematical functions.
</p>
<p>
<a href = "../../cpp_src/test_values/test_values.html">
TEST_VALUES</a>,
a C++ library which
supplies test values of various mathematical functions.
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
Theodore Chihara,<br>
An Introduction to Orthogonal Polynomials,<br>
Gordon and Breach, 1978,<br>
ISBN: 0677041500,<br>
LC: QA404.5 C44.
</li>
<li>
Walter Gautschi,<br>
Orthogonal Polynomials: Computation and Approximation,<br>
Oxford, 2004,<br>
ISBN: 0-19-850672-4,<br>
LC: QA404.5 G3555.
</li>
<li>
John Mason, David Handscomb,<br>
Chebyshev Polynomials,<br>
CRC Press, 2002,<br>
ISBN: 0-8493-035509,<br>
LC: QA404.5.M37.
</li>
<li>
Frank Olver, Daniel Lozier, Ronald Boisvert, Charles Clark,<br>
NIST Handbook of Mathematical Functions,<br>
Cambridge University Press, 2010,<br>
ISBN: 978-0521192255,<br>
LC: QA331.N57.
</li>
<li>
Gabor Szego,<br>
Orthogonal Polynomials,<br>
American Mathematical Society, 1992,<br>
ISBN: 0821810235,<br>
LC: QA3.A5.v23.
</li>
</ol>
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "chebyshev_polynomial.cpp">chebyshev_polynomial.cpp</a>, the source code.
</li>
<li>
<a href = "chebyshev_polynomial.hpp">chebyshev_polynomial.hpp</a>, the include file.
</li>
<li>
<a href = "chebyshev_polynomial.sh">chebyshev_polynomial.sh</a>,
BASH commands to compile the source code.
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "chebyshev_polynomial_prb.cpp">chebyshev_polynomial_prb.cpp</a>,
a sample calling program.
</li>
<li>
<a href = "chebyshev_polynomial_prb.sh">chebyshev_polynomial_prb.sh</a>,
BASH commands to compile and run the sample program.
</li>
<li>
<a href = "chebyshev_polynomial_prb_output.txt">chebyshev_polynomial_prb_output.txt</a>,
the output file.
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>DAXPY</b> computes constant times a vector plus a vector.
</li>
<li>
<b>DDOT</b> forms the dot product of two vectors.
</li>
<li>
<b>DNRM2</b> returns the euclidean norm of a vector.
</li>
<li>
<b>DROT</b> applies a plane rotation.
</li>
<li>
<b>DROTG</b> constructs a Givens plane rotation.
</li>
<li>
<b>DSCAL</b> scales a vector by a constant.
</li>
<li>
<b>DSVDC</b> computes the singular value decomposition of a real rectangular matrix.
</li>
<li>
<b>DSWAP</b> interchanges two vectors.
</li>
<li>
<b>I4_MAX</b> returns the maximum of two I4's.
</li>
<li>
<b>I4_MIN</b> returns the minimum of two I4's.
</li>
<li>
<b>I4_TO_STRING</b> converts an I4 to a C++ string.
</li>
<li>
<b>I4_UNIFORM</b> returns a scaled pseudorandom I4.
</li>
<li>
<b>IMTQLX</b> diagonalizes a symmetric tridiagonal matrix.
</li>
<li>
<b>R4_NINT</b> returns the nearest integer to an R4.
</li>
<li>
<b>R8_ABS</b> returns the absolute value of an R8.
</li>
<li>
<b>R8_ADD</b> adds two R8's.
</li>
<li>
<b>R8_CHOOSE</b> computes the binomial coefficient C(N,K) as an R8.
</li>
<li>
<b>R8_EPSILON</b> returns the R8 roundoff unit.
</li>
<li>
<b>R8_MAX</b> returns the maximum of two R8's.
</li>
<li>
<b>R8_SIGN</b> returns the sign of an R8.
</li>
<li>
<b>R8MAT_COPY_NEW</b> copies one R8MAT to a "new" R8MAT.
</li>
<li>
<b>R8MAT_MTV_NEW</b> multiplies a transposed matrix times a vector.
</li>
<li>
<b>R8MAT_MV_NEW</b> multiplies a matrix times a vector.
</li>
<li>
<b>R8VEC_DOT_PRODUCT</b> computes the dot product of a pair of R8VEC's.
</li>
<li>
<b>R8VEC_IN_AB</b> is TRUE if the entries of an R8VEC are in the range [A,B].
</li>
<li>
<b>R8VEC_LINSPACE_NEW</b> creates a vector of linearly spaced values.
</li>
<li>
<b>R8VEC_MAX</b> returns the value of the maximum element in an R8VEC.
</li>
<li>
<b>R8VEC_PRINT</b> prints an R8VEC.
</li>
<li>
<b>R8VEC_UNIFORM_NEW</b> returns a scaled pseudorandom R8VEC.
</li>
<li>
<b>R8VEC_UNIFORM_01_NEW</b> returns a new unit pseudorandom R8VEC.
</li>
<li>
<b>R8VEC2_PRINT</b> prints an R8VEC2.
</li>
<li>
<b>SVD_SOLVE</b> solves a linear system in the least squares sense.
</li>
<li>
<b>T_DOUBLE_PRODUCT_INTEGRAL:</b> integral (-1<=x<=1) T(i,x)*T(j,x)/sqrt(1-x^2) dx
</li>
<li>
<b>T_INTEGRAL:</b> integral ( -1 <= x <= +1 ) x^e dx / sqrt ( 1 - x^2 ).
</li>
<li>
<b>T_POLYNOMIAL</b> evaluates Chebyshev polynomials T(n,x).
</li>
<li>
<b>T_POLYNOMIAL_AB:</b> Chebyshev polynomials T(n,x) in [A,B].
</li>
<li>
<b>T_POLYNOMIAL_COEFFICIENTS:</b> coefficients of the Chebyshev polynomial T(n,x).
</li>
<li>
<b>T_POLYNOMIAL_VALUE:</b> returns the single value T(n,x).
</li>
<li>
<b>T_POLYNOMIAL_VALUES</b> returns values of the Chebyshev polynomial T(n,x).
</li>
<li>
<b>T_POLYNOMIAL_ZEROS</b> returns zeroes of the Chebyshev polynomial T(n,x).
</li>
<li>
<b>T_PROJECT_COEFFICIENTS:</b> function projected onto Chebyshev polynomials T(n,x).
</li>
<li>
<b>T_PROJECT_COEFFICIENTS_AB:</b> function projected onto T(n,x) over [a,b]
</li>
<li>
<b>T_PROJECT_COEFFICIENTS_DATA:</b> project data onto Chebyshev polynomials T(n,x).
</li>
<li>
<b>T_PROJECT_VALUE</b> evaluates an expansion in Chebyshev polynomials T(n,x).
</li>
<li>
<b>T_PROJECT_VALUE_AB</b> evaluates an expansion in Chebyshev polynomials T(n,x).
</li>
<li>
<b>T_QUADRATURE_RULE:</b> quadrature rule for T(n,x).
</li>
<li>
<b>T_TRIPLE_PRODUCT_INTEGRAL:</b> integral (-1<=x<=1) T(i,x)*T(j,x)*T(k,x)/sqrt(1-x^2) dx
</li>
<li>
<b>TIMESTAMP</b> prints the current YMDHMS date as a time stamp.
</li>
<li>
<b>U_DOUBLE_PRODUCT_INTEGRAL:</b> integral (-1<=x<=1) U(i,x)*U(j,x)*sqrt(1-x^2) dx
</li>
<li>
<b>U_INTEGRAL:</b> integral ( -1 <= x <= +1 ) x^e sqrt ( 1 - x^2 ) dx.
</li>
<li>
<b>U_POLYNOMIAL</b> evaluates Chebyshev polynomials U(n,x).
</li>
<li>
<b>U_POLYNOMIAL_COEFFICIENTS</b> evaluates coefficients of Chebyshev polynomials U(n,x).
</li>
<li>
<b>U_POLYNOMIAL_VALUES</b> returns values of Chebyshev polynomials U(n,x).
</li>
<li>
<b>U_POLYNOMIAL_ZEROS</b> returns zeroes of Chebyshev polynomials U(n,x).
</li>
<li>
<b>U_QUADRATURE_RULE:</b> quadrature rule for U(n,x).
</li>
<li>
<b>V_DOUBLE_PRODUCT_INTEGRAL:</b> integral (-1<=x<=1) V(i,x)*V(j,x)*sqrt(1+x)/sqrt(1-x) dx
</li>
<li>
<b>V_POLYNOMIAL</b> evaluates Chebyshev polynomials V(n,x).
</li>
<li>
<b>V_POLYNOMIAL_VALUES</b> returns values of Chebyshev polynomials V(n,x).
</li>
<li>
<b>V_POLYNOMIAL_ZEROS</b> returns zeroes of the Chebyshev polynomial V(n,x).
</li>
<li>
<b>W_DOUBLE_PRODUCT_INTEGRAL:</b> integral (-1<=x<=1) W(i,x)*W(j,x)*sqrt(1-x)/sqrt(1+x) dx
</li>
<li>
<b>W_POLYNOMIAL</b> evaluates Chebyshev polynomials W(n,x).
</li>
<li>
<b>W_POLYNOMIAL_VALUES</b> returns values of Chebyshev polynomials W(n,x).
</li>
<li>
<b>W_POLYNOMIAL_ZEROS</b> returns zeroes of the Chebyshev polynomial W(n,x).
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../cpp_src.html">
the C++ source codes</a>.
</p>
<hr>
<i>
Last revised on 26 April 2012.
</i>
<!-- John Burkardt -->
</body>
<!-- Initial HTML skeleton created by HTMLINDEX. -->
</html>