orthpoly::curtz -- the Curtz
polynomials
Introductionorthpoly::curtz(n,x) computes the value of
the n-th degree Curtz polynomial at the point
x.
Call(s)orthpoly::curtz(n, x)
Parametersn |
- | a nonnegative integer: the degree of the polynomial. |
x |
- | an indeterminate or an arithmetical expression. An
indeterminate is either an identifier (of domain type DOM_IDENT) or an indexed
identifier (of type "_index"). |
ReturnsIf x is an indeterminate, then a polynomial of domain
type DOM_POLY is
returned. If x is an arithmetical expression, then the
value of the Curtz polynomial at this point is returned as an
arithmetical expression. If n is not a nonnegative
integer, then orthpoly::curtz returns itself
symbolically.
Details
Example
1Polynomials of domain type DOM_POLY are returned, if
identifiers or indexed identifiers are specified:
>> orthpoly::curtz(2, x)
2
poly(x - x + 1/3, [x])
>> orthpoly::curtz(3, x[1])
3 2
poly(x[1] - 3/2 x[1] + 11/12 x[1] - 1/4, [x[1]])
However, using arithmetical expressions as input the ``values'' of these polynomials are returned:
>> orthpoly::curtz(2, 6*x)
6 x (6 x - 1/2) - 3 x + 1/3
>> orthpoly::curtz(3, x[1] + 2)
x[1] / x[1] \
---- + (x[1] + 3/2) | - ---- - 1 | +
3 \ 2 /
/ x[1] \
(x[1] + 2) | (x[1] + 2) (x[1] + 3/2) - ---- - 2/3 | + 5/12
\ 2 /
``Arithmetical expressions'' include numbers:
>> orthpoly::curtz(2, sqrt(2)), orthpoly::curtz(3, 8 + I), orthpoly::curtz(100, 0.3)
1/2
1/2 1/2 2
2 (2 - 1/2) - ---- + 1/3, 4807/12 + 2015/12 I,
2
0.001395122936
If no integer degree is specified, then
orthpoly::curtz returns itself symbolically:
>> orthpoly::curtz(n, x), orthpoly::curtz(1/2, x)
orthpoly::curtz(n, x), orthpoly::curtz(1/2, x)
Example
2If a floating point value is desired, then a direct call such as
>> orthpoly::curtz(50, 1.2)
0.0003843630923
is appropriate and yields a correct result. One should not evaluate the symbolic polynomial at a floating point value, because this may be numerically unstable:
>> orthpoly::curtz(50, x): evalp(%, x = 1.2)
0.0003843575545
Note that due to numerical round-off only 4 digits are correct.
Background
C(n,x)=x^n + x*sum((-1^i)/(i+1)*C(n-i+1,x),i=1...n-1)
+ ((-1)^n)/(n+1)
with C(0,x)=1.