Abstract
In computer-aided geometric design, a polynomial surface is usually represented in Bézier form. The usual form of evaluating such a surface is by using an extension of the de Casteljau algorithm. Using error-free transformations, a compensated version of this algorithm is presented, which improves the usual algorithm in terms of accuracy. A forward error analysis illustrating this fact is developed.
1. Introduction
The Horner algorithm is the most usual method for the evaluation of polynomials. Important algorithms in computer-aided geometric design (CAGD) need to compute roots of curves and surfaces. Some of the algorithms, in order to compute those roots, need to evaluate accurately the curves and surfaces at points close to the roots (see [1,2]). These evaluations are ill-conditioned, and accurate evaluation algorithms could play a key role in the performances of some of these root finding algorithms. In the last few years, in the literature it has been shown that the de Casteljau algorithm outperforms Horner’s algorithm, among other evaluation algorithms, from the point of view of accuracy (see [3,4,5,6,7,8]). The de Casteljau algorithm evaluates polynomials represented in Bézier form, that is, using the Bernstein polynomials. In CAGD it is the usual evaluation algorithm for polynomial curves.
In CAGD, polynomials (curves and surfaces) are usually represented in Bernstein form, by using the Bernstein polynomials of degree n. A polynomial in the Bézier form is evaluated by the de Casteljau algorithm in the bivariate case and by an extended version in the multivariate case. The error analysis of these algorithms in [6,7] shows a relative error bound of the following form:
where u is the unit roundoff of the computing precision. For an ill-conditioned problem, such as the evaluation of a polynomial at parameters very close to a multiple root, the condition number can exceed . In that case we can obtain an approximation of the polynomial at the parameter value with almost all its digits being false.
Error-free transformations (EFTs) have been studied by Rump and Ogita in [9,10,11]. In [12], applying EFTs, Graillat and Langlois presented a compensated version of the usual Horner algorithm to evaluate polynomials represented in the power basis. Later, in [13] a compensated de Casteljau algorithm for the evaluation of univariate polynomialas was devised. The relative error bound for this algorithm has the following form:
which improves the bound for the usual de Casteljau algorithms in (1).
In [7], an error analysis was performed for the extension of the de Casteljau algorithm for tensor product surfaces in Bernstein-Bézier form. In this paper, applying EFTs, we present a compensated version of this algorithm for the evaluation of those surfaces with improved accuracy.
The layout of the paper is as follows. Section 2 introduces some basic notation and results about error analysis with floating point arithmetic; the EFTs; the de Casteljau algorithm for polynomial curves and its compensated version. Section 3 recalls the extension of the de Casteljau algorithm for the evaluation of tensor product surfaces and the corresponding error analysis. Then, the compensated de Casteljau algorithm for Bézier tensor product surfaces is devised and the corresponding error analysis performed, providing a better bound for the error.
2. Basic Notation and Results
2.1. Floating Point Arithmetic and Forward Error Analysis
Given a real number x, the computed element in floating point arithmetic will be denoted by either or . Let us assume that u is the unit roundoff of the arithmetic floating point system we are using. In error analysis, the study of the effect of rounding errors is usually carried out by using one of the following two models.
where is any one of the operations (for more details see pages 40–41 of [14]). Now let us define
where verifies . Given with for all i, in error analysis it is usual to deal with quantities satisfying that . In Lemma 3.1 of [14] it was proved that their absolute value is bounded above by , that is, . The following result summarizes some classic properties in error analysis (see Lemma 3.3 of [14]).
Lemma 1.
- i.
- ,
- ii.
- for ,
- iii.
- ,
- iv.
- ,
- v.
- .
Condition numbers of the functions to be evaluated are important for the accuracy of the result. Let us now recall some condition numbers related to the evaluation of functions. Given a space of functions defined on , a basis for and a function , measures of the sensitivity of to perturbations in are important in error analysis of the evaluation algorithms. Thus, given a relative perturbation of the coefficients c, we obtain the function , which is related to f. Then for any
The number
plays the role of a condition number for the evaluation of the function f at x using the basis B (see [4,5,15,16,17]).
In CAGD, it is usual that the basis B must be formed of blending functions; that is, each basis function must be nonnegative on , and the sum of all bases functions must be equal to 1 for all point in . If is a basis of blending functions and () then .
In floating point arithmetic, given an algorithm for the evaluation of the function , one obtains the computed value or . From a practical point of view, to obtain an error bound or estimate for the approximation of the exact evaluation given by , it is desirable. The success on the accuracy of the obtained aproximation when using an evaluation algorithm despends on:
- The backward error—that is, the error of the calculations of the algorithm;
- The difficulty of the evaluated function—that is, the condition number of the function with respect to the basis used as a representation by the evaluation algorithm.
In error analysis, the computed can be expressed as , where is a perturbation in c. Thus, the upper bound of the forward error for evaluation in formula (4) is usually interpreted as a product of the backward error and the condition number (cf. [14]).
2.2. Error-Free Transformations
Error-free transformations (EFTs) will be taken into account in our algorithms in order to improve accuracy. In particular, TwoSum and TwoProduct EFTs will be used (see [9]) for computing sums and products, respectively. The algorithm TwoSum for the sum was presented by Knuth in [18], whereas the algorithm TwoProduct for the product was presented by Dekker, due to G. W. Veltkamp, in [19]. Algorithms 1 and 2 show these algorithms (TwoSum and TwoProduct), Algorithm 3 is used by Algorithm 2.
| Algorithm 1 TwoSum algorithm. |
| Require: |
| Ensure: such that |
| Algorithm 2 TwoProduct algorithm. |
| Require: |
| Ensure: such that |
| 1: |
| 2: |
| 3: |
| 4: |
| Algorithm 3 Split algorithm. |
| Require:a |
| Ensure: such that |
| 1: in IEEE 754 |
| 2: |
| 3: |
Error analyses of both algorithms were presented in Theorem 3.4 of [9] and Théorème 3.14 of [20]. The following result shows a summary of these results.
Theorem 1.
Let be the set of standard floating point numbers corresponding to a certain floating point arithmetic. If , then:
- i.
- verifies
- ii.
- ; if not, underflow occurs,
2.3. De Casteljau Algorithm for Polynomial Curves in Bézier Form
The Horner algorithm is the best well-known method for polynomial evaluation. It uses the monomial basis of the space , , , given by , . Given , the error analysis of the Horner algorithm in chapter 5 of [14] shows that
In CAGD the usual evaluation algorithm for polynomial curves is the de Casteljau algorithm. This algorithm evaluates polynomials represented using the Bernstein basis (see [21]). The Bernstein polynomials of degree n, , , form a basis of and are defined by
A polynomial
is said to be in Bézier form or in Bernstein–/Bézier form. Algorithm 4 shows the de Casteljau algorithm for the evaluation of polynomials in Bézier form (6).
| Algorithm 4 De Casteljau algorithm for the evaluation of at t. |
| Require: and |
| Ensure: |
| for to n do |
| end for |
| for to n do |
| for to do |
| end for |
| end for |
A corner cutting algorithm is an algorithm such that each step is formed by linear convex combinations (see [6]). The de Casteljau algorithm is a corner cutting algorithm. In [6] an error analysis of corner cutting algorithms was carried out, which for the particular case of the de Casteljau algorithm can be written as
In addition, the optimal conditioning of Bernstein basis for polynomial evaluation among all the bases formed by nonnegative polynomials on was shown in [5]. Thus, there does not exist another basis of , up to positive scaling, formed by nonnegative polynomials on that is better conditioned for every at every point . In particular, we have for all and . Hence, the part of the error bound corresponding to the condition number for the de Casteljau algorithm is lower than the corresponding part of the bound for the Horner algorithm. In fact, the numerical experiments in [3] show that the algorithms using the Bernstein representation, like the de Casteljau algorithm, present better stability properties than the Horner algorithm.
2.4. Compensated Evaluation Algorithms for Bézier Curves
It is usual to apply EFTs (see [9] and Section 2.2) in order to devise compensated evaluation algorithms providing more accurate results. Hence, in [22,23] Graillat, Langlois and Louvet devised a compensated Horner algorithm for the evaluation of a polynomial in monomial form. In Theorem 5 of [22] it was proved that the evaluation of a degree n polynomial with the compensated Horner algorithm provides an approximation verifying
In [13] a compensated de Casteljau algorithm for the evaluation of polynomials curves in Bernstein-Bézier form was presented. In Theorem 5 of [13] it was proved that the evaluation of a degree n polynomial with the compensated de Casteljau algorithm provides an approximation verifying
According to the previous bound for problems where
the relative error for the approximations provided by the compensated de Casteljau algorithm is u.
3. Evaluation Algorithms for Tensor Product Bézier Surfaces
In CAGD ensor product polynomial surfaces are usually represented in the Bernstein-Bézier form (see [21]) by using tensor product Bernstein systems.
Definition 1.
Let and be two Bernstein systems defined on , where and , are the Bernstein polynomials of degree k. The system is called a tensor product Bernstein system and the surface
is called a tensor product Bézier surface.
A tensor product Bézier surface can be evaluated by de Casteljau type evaluation algorithm inspired in the de Castaljau evaluation algorithm for Bézier curves (see [21]). By considering the components of the points , the evaluation of (7) depends on the evaluation of scalar functions. Hence, based on the de Casteljau algorithm for Bézier curves, the corresponding evaluation algorithm for tensor product Bézier surfaces is shown in Algorithm 5.
| Algorithm 5 De Casteljau algorithm for the evaluation of F in (7). |
| Require: and |
| Ensure: |
| for to m do |
| for to n do |
| end for |
| end for |
| for to m do |
| for to n do |
| for to do |
| end for |
| end for |
| end for |
| for do |
| for to do |
| end for |
| end for |
In Theorem 5 of [7], error analyses of algorithms evaluating tensor product surfaces were performed. Taking into account the roundoff error when computing , for the particular case of tensor product Bézier surfaces we have the following error analysis of Algorithm 5.
Theorem 2.
Let us consider the system of functions defined on . Let be given by (7), and let us suppose that , where u is the unit roundoff. Then, the value computed in floating point arithmetic through Algorithm 5 satisfies
Compensated de Casteljau Evaluation Algorithm for Tensor Product Bézier Surfaces
In this section we devise a compensated de Casteljau algorithm for the evaluation of tensor product surfaces—that is, a compensated version of Algorithm 5. In order to track the local errors at each step, the following EFTs will be used:
Then we can describe the error in the following way:
Now let us define the global errors at each step as
It can be seen that the local error satisfies the following expressions:
If computations are performed in exact arithmetic:
Taking into account the previous discussion, Algorithm 6 shows the corresponding compensated version of the de Casteljau algorithms for tensor product Bézier surfaces.
| Algorithm 6 Compensated de Casteljau algorithm for the evaluation of F in (7). |
| Require: and |
| Ensure: |
| for to m do |
| for to n do |
| end for |
| end for |
| for to m do |
| for to n do |
| for to do |
| end for |
| end for |
| end for |
| fordo |
| for to do |
| end for |
| end for |
Now an error analysis of the compensated de Casteljau algorithm for the evaluation of tensor product surfaces (Algorithm 6) will be carried out. First, an auxiliary result will be proved.
Lemma 2.
Let be a bivariate polynomial and . Then, the de Casteljau algorithm for tensor product surfaces, i.e., Algorithm 5, verifies:
- i.
- , for all .
- ii.
- .
Proof.
- i.
- Since and we haveBy using the recurrence relation of the Bernstein polynomials, , we can deriveBy iterating this procedure, we obtain all the inequalities in i.
- ii.
- Analogous to i.
□
The error analysis for was already seen in [7] (and recalled in Theorem 2). Hence, let us see how the roundoff errors affect the computation of using floating point arithmetic.
Theorem 3.
Let be the computed value in Algorithm 6 as an approximation of the exact value in (8). If no underflow occurs, then
Proof.
By formula (8) and using i of Lemma 1, we can prove by induction hypothesis on that
for and . Then, analogously, we can also prove by induction hypothesis on that
for .
By formula (10) for we can deduce that
By Theorem 1 we can derive
By formulas in (12) we deduce that
Analogously we can deduce that
Taking into account that , , and for and using the well known recurrence relation for Bernstein polynomials , it is derived that
By the error analysis of Theorem 2 performed in [7] we have that
where is a quantity usual in error analysis satisfying that (for more details see Section 2.1 and [14]). Then we can obtain
Then, applying Lemma 1 and that , we derive
By (11) and taking into account that and that we conclude
Taking into account that and that, by v of Lemma 1, , the result follows. □
Finally, the following result shows the error analysis of the approximation to a tensor product Bézier surface obtained with the compensated de Casteljau algorithm (Algorithm 6).
Theorem 4.
Let be a tensor product Bézier polynomial with and the approximation of computed by Algorithm 6. Then
Proof.
By Algorithm 6 we have that
By (9) and taking into account that , we deduce
Then, by Theorem 3 we have
Since we can deduce
and the result follows. □
Remark 1.
Assuming that , the error bound for the evaluation of tensor product surfaces by the compensated de Casteljau algorithm obtained in the previous theorem is much lower than the error bound corresponding to the usual de Casteljau algorithm in Theorem 2. The assumption is typical when working in a CAGD framework. In fact, if
the relative error for the approximation provided by the compensated de Casteljau is u.
4. Conclusions
A compensated version of the de Casteljau algorithm for tensor product functions has been presented. This new method is carried out with the usual floating point arithmetic and operations, and it uses only the same working precision as the data. With this framework, the following bound for the relative error of the new compensated method has been provided:
which is lower than the bound corresponding to the usual method
Hence, the new compensated de Casteljau algorithm for tensor product functions can be quite useful for problems with ill-conditioned situations.
Funding
This work was funded by the Spanish research grant PGC2018-096321-B-I00 (MCIU/AEI), by Gobierno de Aragón (E41-17R) and Feder 2014–2020 “Construyendo Europa desde Aragón”.
Conflicts of Interest
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.
Abbreviations
The following abbreviations are used in this manuscript:
| CAGD | Computer-aided geometric design |
| EFT | Error-free transformation |
References
- Wei, F.; Zhou, F.; Feng, J. Survey of real root finding of univariate polynomial equation in CAGD/CG. J. Comput.-Aided Des. Comput. Graph. 2011, 23, 193–207. [Google Scholar]
- McNamee, J.M. Numerical Methods for Roots of Polynomials: Part 1: Volume 14, (Studies in Computational Mathematics); Elsevier: Amsterdam, The Netherlands, 2007. [Google Scholar]
- Delgado, J.; Peña, J.M. Running Relative Error for the Evaluation of Polynomials. SIAM J. Sci. Comput. 2009, 31, 3905–3921. [Google Scholar] [CrossRef]
- Farouki, R.T.; Rajan, V.T. On the numerical condition of polynomials in Bernstein form. Comput. Aided Geom. Des. 1987, 4, 191–216. [Google Scholar] [CrossRef]
- Farouki, R.T.; Goodman, T.N.T. On the optimal stability of the Bernstein basis. Math. Comp. 1996, 65, 1553–1566. [Google Scholar] [CrossRef]
- Mainar, E.; Peña, J.M. Error analysis of corner cutting algorithms. Numer. Algorithms 1999, 22, 41–52. [Google Scholar] [CrossRef]
- Delgado, J.; Peña, J.M. Error analysis of efficient evaluation algorithms for tensor product surfaces. J. Comput. Appl. Math. 2008, 219, 156–169. [Google Scholar] [CrossRef]
- Delgado, J.; Peña, J.M. Algorithm 960: POLYNOMIAL: An Object-Oriented Matlab Library of Fast and Efficient Algorithms for Polynomials. ACM Trans. Math. Softw. 2016, 42, 19. [Google Scholar] [CrossRef]
- Ogita, T.; Rump, S.M.; Oishi, S. Accurate sum and dot product. SIAM J. Sci. Comput. 2005, 26, 1955–1988. [Google Scholar] [CrossRef]
- Rump, S.M.; Ogita, T.; Oishi, S. Accurate Floating-Point Summation Part I: Faithful Rounding. SIAM J. Sci. Comput. 2008, 31, 189–224. [Google Scholar] [CrossRef]
- Rump, S.M.; Ogita, T.; Oishi, S. Accurate floating-point summation part II: Sign, K-fold faithful and rounding to nearest. SIAM J. Sci. Comput. 2008, 31, 1269–1302. [Google Scholar] [CrossRef]
- Graillat, S.; Langlois, P.; Louvet, N. Algorithms for accurate, validated and fast polynomial evaluation. Jpn. J. Ind. Appl. Math. 2009, 26, 191–214. [Google Scholar] [CrossRef]
- Jiang, H.; Li, S.; Cheng, L.; Su, F. Accurate evaluation of a polynomial and its derivative in Bernstein form. Comput. Math. Appl. 2010, 60, 744–755. [Google Scholar] [CrossRef][Green Version]
- Higham, N.J. Accuracy and Stability of Numerical Algorithms, 2nd ed.; SIAM: Philadelphia, PA, USA, 2002. [Google Scholar]
- Lyche, T.; Peña, J.M. Optimally stable multivariate bases. Adv. Comput. Math. 2004, 20, 149–159. [Google Scholar] [CrossRef]
- Peña, J.M. On the optimal stability of bases of univariate functions. Numer. Math. 2002, 91, 305–318. [Google Scholar] [CrossRef]
- Peña, J.M. A note on the optimal stability of bases of univariate functions. Numer. Math. 2006, 103, 151–154. [Google Scholar] [CrossRef]
- Knuth, D.E. The Art of Computer Programming, Volume 2: Seminumerical Algorithms; Addison Wesley: Boston, MA, USA, 1969. [Google Scholar]
- Dekker, T.J. A floating-point technique for extending the available precision. Numer. Math. 1971, 18, 224–242. [Google Scholar] [CrossRef]
- Louvet, N. Algorithmes Compensés en Arithmétique Flottante: Précision, Validation, Performances. Ph.D. Thesis, University of Perpignan, Perpignan, France, 2007. [Google Scholar]
- Farin, G. Curves and Surfaces for Computer Aided Geometric Design, 5th ed.; Academic Press: San Diego, CA, USA, 2002. [Google Scholar]
- Langlois, P.H.; Louvet, N.; Graillat, S. Compensated Horner Scheme; Technical Report RR2005-04; Université de Perpignan Via Domitia: Perpignan, France, 2005. [Google Scholar]
- Langlois, P.H.; Louvet, N. How to Ensure a Faithful Polynomial Evaluation with the Compensated Horner Algorithm. In Proceedings of the 18th IEEE Symposium on Computer Arithmetic (ARITH’07), Montepellier, France, 25–27 June 2007; pp. 141–149. [Google Scholar]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2020 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).