forked from johannesgerer/jburkardt-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdivdif.html
364 lines (328 loc) · 10.7 KB
/
divdif.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
<html>
<head>
<title>
DIVDIF - Divided Difference Polynomials
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
DIVDIF <br> Divided Difference Polynomials
</h1>
<hr>
<p>
<b>DIVDIF</b>
is a C++ library which
creates, prints and manipulates divided difference
polynomials.
</p>
<p>
Divided difference polynomials are a
systematic method of computing polynomial approximations to scattered
data. The representations are compact, and may easily be updated with
new data, rebased at zero, or analyzed to produce the standard form
polynomial, integral or derivative polynomials.
</p>
<p>
Other routines are available to convert the divided difference
representation into standard polynomial format. This is a natural
way to determine the coefficients of the polynomial that interpolates
a given set of data, for instance.
</p>
<p>
One surprisingly simple but useful routine is available to take
a set of roots and compute the divided difference or standard form
polynomial that passes through those roots.
</p>
<p>
Finally, the Newton-Cotes quadrature formulas can be derived using
divided difference methods, so a few routines are given which can
compute the weights and abscissas of open or closed rules for an
arbitrary number of nodes.
</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>DIVDIF</b> is available in
<a href = "../../c_src/divdif/divdif.html">a C version</a> and
<a href = "../../cpp_src/divdif/divdif.html">a C++ version</a> and
<a href = "../../f77_src/divdif/divdif.html">a FORTRAN77 version</a> and
<a href = "../../f_src/divdif/divdif.html">a FORTRAN90 version</a> and
<a href = "../../m_src/divdif/divdif.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/differ/differ.html">
DIFFER</a>,
a C++ library which
determines the finite difference coefficients necessary in order to
combine function values at known locations to compute an approximation
of given accuracy to a derivative of a given order.
</p>
<p>
<a href = "../../cpp_src/lagrange_interp_1d/lagrange_interp_1d.html">
LAGRANGE_INTERP_1D</a>,
a C++ library which
defines and evaluates the Lagrange polynomial p(x)
which interpolates a set of data, so that p(x(i)) = y(i).
</p>
<p>
<a href = "../../cpp_src/rbf_interp/rbf_interp.html">
RBF_INTERP</a>,
a C++ library which
defines and evaluates radial basis function (RBF) interpolants to multidimensional data.
</p>
<p>
<a href = "../../cpp_src/spline/spline.html">
SPLINE</a>,
a C++ library which
includes many routines to construct
and evaluate spline interpolants and approximants.
</p>
<p>
<a href = "../../cpp_src/test_approx/test_approx.html">
TEST_APPROX</a>,
a C++ library which
defines test problems for approximation,
provided as a set of (x,y) data.
</p>
<p>
<a href = "../../cpp_src/test_interp_1d/test_interp_1d.html">
TEST_INTERP_1D</a>,
a C++ library which
defines test problems for interpolation of data y(x),
depending on a 1D argument.
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
Philip Davis,<br>
Interpolation and Approximation,<br>
Dover, 1975,<br>
ISBN: 0-486-62495-1,<br>
LC: QA221.D33
</li>
<li>
Carl deBoor,<br>
A Practical Guide to Splines,<br>
Springer, 2001,<br>
ISBN: 0387953663,<br>
LC: QA1.A647.v27.
</li>
<li>
Jean-Paul Berrut, Lloyd Trefethen,<br>
Barycentric Lagrange Interpolation,<br>
SIAM Review,<br>
Volume 46, Number 3, September 2004, pages 501-517.
</li>
<li>
FM Larkin,<br>
Root Finding by Divided Differences,<br>
Numerische Mathematik,<br>
Volume 37, pages 93-104, 1981.
</li>
</ol>
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "divdif.cpp">divdif.cpp</a>, the source code;
</li>
<li>
<a href = "divdif.hpp">divdif.hpp</a>, the include file;
</li>
<li>
<a href = "divdif.sh">divdif.sh</a>,
commands to compile the source code;
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "divdif_prb.cpp">divdif_prb.cpp</a>, the calling program;
</li>
<li>
<a href = "divdif_prb.sh">divdif_prb.sh</a>, commands to
compile, link and run the calling program;
</li>
<li>
<a href = "divdif_prb_output.txt">divdif_prb_output.txt</a>,
the output file.
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>CHEBY_T_ZERO</b> returns zeroes of the Chebyshev polynomial T(N)(X).
</li>
<li>
<b>CHEBY_U_ZERO</b> returns zeroes of the Chebyshev polynomial U(N)(X).
</li>
<li>
<b>DATA_TO_DIF</b> sets up a divided difference table from raw data.
</li>
<li>
<b>DATA_TO_DIF_NEW</b> sets up a divided difference table from raw data.
</li>
<li>
<b>DATA_TO_DIF_DISPLAY</b> sets up a divided difference table and prints out intermediate data.
</li>
<li>
<b>DATA_TO_R8POLY</b> computes the coefficients of a polynomial interpolating data.
</li>
<li>
<b>DIF_ANTIDERIV</b> integrates a polynomial in divided difference form.
</li>
<li>
<b>DIF_APPEND</b> adds a pair of data values to a divided difference table.
</li>
<li>
<b>DIF_BASIS</b> computes all Lagrange basis polynomials in divided difference form.
</li>
<li>
<b>DIF_BASIS_I</b> computes the I-th Lagrange basis polynomial in divided difference form.
</li>
<li>
<b>DIF_DERIV</b> computes the derivative of a polynomial in divided difference form.
</li>
<li>
<b>DIF_PRINT</b> prints the polynomial represented by a divided difference table.
</li>
<li>
<b>DIF_SHIFT_X</b> replaces one abscissa of a divided difference table with a new one.
</li>
<li>
<b>DIF_SHIFT_ZERO</b> shifts a divided difference table so that all abscissas are zero.
</li>
<li>
<b>DIF_TO_R8POLY</b> converts a divided difference table to a standard polynomial.
</li>
<li>
<b>DIF_VAL</b> evaluates a divided difference polynomial at a point.
</li>
<li>
<b>DIF_VALS</b> evaluates a divided difference polynomial at a set of points.
</li>
<li>
<b>LAGRANGE_RULE</b> computes the weights of a Lagrange interpolation rule.
</li>
<li>
<b>LAGRANGE_SUM</b> carries out a Lagrange interpolation rule.
</li>
<li>
<b>LAGRANGE_VAL</b> applies a naive form of Lagrange interpolation.
</li>
<li>
<b>NC_RULE</b> computes the weights of a Newton-Cotes quadrature rule.
</li>
<li>
<b>NCC_RULE</b> computes the coefficients of a Newton-Cotes closed quadrature rule.
</li>
<li>
<b>NCO_RULE</b> computes the coefficients of a Newton-Cotes open quadrature rule.
</li>
<li>
<b>R8_SWAP</b> swaps two R8's.
</li>
<li>
<b>R8POLY_ANT_COF</b> integrates an R8POLY in standard form.
</li>
<li>
<b>R8POLY_ANT_VAL</b> evaluates the antiderivative of an R8POLY in standard form.
</li>
<li>
<b>R8POLY_BASIS</b> computes all Lagrange basis polynomials in standard form.
</li>
<li>
<b>R8POLY_BASIS_1</b> computes the I-th Lagrange basis polynomial in standard form.
</li>
<li>
<b>R8POLY_DER_COF</b> computes the coefficients of the derivative of a real polynomial.
</li>
<li>
<b>R8POLY_DER_VAL</b> evaluates the derivative of a real polynomial in standard form.
</li>
<li>
<b>R8POLY_ORDER</b> returns the order of a polynomial.
</li>
<li>
<b>R8POLY_PRINT</b> prints out a real polynomial in standard form.
</li>
<li>
<b>R8POLY_SHIFT</b> adjusts the coefficients of a polynomial for a new argument.
</li>
<li>
<b>R8POLY_VAL_HORNER</b> evaluates a real polynomial in standard form.
</li>
<li>
<b>R8VEC_DISTINCT</b> is true if the entries in an R8VEC are distinct.
</li>
<li>
<b>R8VEC_INDICATOR</b> sets an R8VEC to the indicator vector {1,2,3...}.
</li>
<li>
<b>R8VEC_PRINT</b> prints an R8VEC.
</li>
<li>
<b>ROOTS_TO_DIF</b> sets a divided difference table for a polynomial from its roots.
</li>
<li>
<b>ROOTS_TO_R8POLY</b> converts polynomial roots to polynomial coefficients.
</li>
<li>
<b>S_LEN_TRIM</b> returns the length of a string to the last nonblank.
</li>
<li>
<b>TIMESTAMP</b> prints the current YMDHMS date as a time stamp.
</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 25 May 2011.
</i>
<!-- John Burkardt -->
</body>
</html>