ComplexBox
EvaluatePolynomial
evaluate a univariate polynomial at a ComplexBox object
Calling Sequence
Parameters
Description
Compatibility
EvaluatePolynomial(a, [c0, c1, ..., cn])
EvaluatePolynomial(a, [c0, c1, ..., cn], precopt)
a
-
a ComplexBox object
c0, c1, ..., cn
complex constants or ComplexBox objects
precopt
(optional) equation of the form precision = n, where n is a positive integer
The EvaluatePolynomial command evaluates a dense univariate polynomial at a ComplexBox object. It does this in a manner that sometimes produces a smaller radius than simple evaluation using the standard arithmetic operations.
The first argument is a ComplexBox object, representing the value at which the polynomial is to be evaluated.
The second argument is a list of n+1 coefficients of the polynomial to be evaluated, where n is the degree of the polynomial. The first entry is the constant coefficient, the second the linear coefficient, and so on. Each coefficient can be a ComplexBox object or a complex constant.
Consider the polynomial 49⁢x4−188⁢x2+72⁢x+292. Evaluate it at the ComplexBox object with center −1.47 and radius 0.01 in the imaginary direction. We first use simple evaluation using the regular arithmetic operators.
poly := 292 + 72*x - 188*x^2 + 49*x^4;
poly≔49⁢x4−188⁢x2+72⁢x+292
cb := ComplexBox(RealBox(-1.47), RealBox(0, 0.01));
cb≔⟨ComplexBox: [-1.47 +/- 1.16415e-10]+[0 +/- 0.01]⋅I⟩
eval(poly, x = cb);
⟨ComplexBox: [8.71575 +/- 0.0823313]+[0 +/- 12.4735]⋅I⟩
The radius of the result is smaller if we first convert the polynomial to Horner form.
poly_horner := convert(poly, 'horner');
poly_horner≔292+72+49⁢x2−188⁢x⁢x
eval(poly_horner, x = cb);
⟨ComplexBox: [8.71575 +/- 0.0611543]+[0 +/- 6.24749]⋅I⟩
However, this is still a severe overestimation of the radius. We write x=−1.47+I⁢ε and expand poly as a polynomial in ε:
poly_eps := evalc(eval(poly, x = -1.47 + epsilon * I));
poly_eps≔8.7157517−447.3046⁢ε2+49⁢ε4+I⁢2.121492⁢ε+288.12⁢ε3
We now plot the real and imaginary parts of the resulting polynomial as ε varies between −0.01 and 0.01.
poly_im, poly_re := selectremove(has, poly_eps, I);
poly_im,poly_re≔I⁢2.121492⁢ε+288.12⁢ε3,8.7157517−447.3046⁢ε2+49⁢ε4
plot(poly_re, epsilon=-0.01 .. 0.01);
plot(poly_im/I, epsilon=-0.01 .. 0.01);
We see that the real part achieves its maximum at ε=0 and its minimum at ε=0.01, and the imaginary part achieves its maximum at ε=0.01 and its minimum at ε=−0.01.
eval(poly_re, epsilon=0), eval(poly_re, epsilon=0.01);
8.7157517,8.67102173
eval(poly_im/I, epsilon=0.01), eval(poly_im/I, epsilon=-0.01);
0.02150304,−0.02150304
So ideally we would like the result to have a center of about 8.694, the real part should have a radius of about 0.023, and the imaginary part should have a radius of about 0.022. We don't quite achieve that with EvaluatePolynomial, but we get much closer than with the other options above.
EvaluatePolynomial(cb, PolynomialTools:-CoefficientList(poly, x));
⟨ComplexBox: [8.71575 +/- 0.044731]+[0 +/- 0.021503]⋅I⟩
The ComplexBox:-EvaluatePolynomial command was introduced in Maple 2024.
For more information on Maple 2024 changes, see Updates in Maple 2024.
See Also
RealBox:-EvaluatePolynomial
Download Help Document