14
Research Article Accurate Evaluation of Polynomials in Legendre Basis Peibing Du, 1 Hao Jiang, 2 and Lizhi Cheng 1 1 Department of Mathematics and Systems Science, College of Science, National University of Defense Technology, Changsha 410073, China 2 e State Key Laboratory for High Performance Computation, College of Computer Science, National University of Defense Technology, Changsha 410073, China Correspondence should be addressed to Peibing Du; duli [email protected] Received 22 April 2014; Accepted 2 July 2014; Published 23 July 2014 Academic Editor: Roberto Barrio Copyright © 2014 Peibing Du et al. is is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. is paper presents a compensated algorithm for accurate evaluation of a polynomial in Legendre basis. Since the coefficients of the evaluated polynomial are fractions, we propose to store these coefficients in two floating point numbers, such as double- double format, to reduce the effect of the coefficients’ perturbation. e proposed algorithm is obtained by applying error-free transformation to improve the Clenshaw algorithm. It can yield a full working precision accuracy for the ill-conditioned polynomial evaluation. Forward error analysis and numerical experiments illustrate the accuracy and efficiency of the algorithm. 1. Introduction Legendre polynomial is oſten used in numerical analysis [13], such as approximation theory and quadrature and differential equations. Legendre polynomial satisfies 3-term recurrence relation; that is, for Legendre polynomial (), 0 () = 1 1 () = +1 () = 2 + 1 +1 () − +1 −1 () ( > 0) . (1) e polynomial represented in Legendre basis is () = =0 (), where R and () is Legendre polyno- mial. e Clenshaw algorithm [4, 5] is usually used to evaluate a linear combination of Chebyshev polynomials, but it can apply to any class of functions that can be defined by a three-term recurrence relation. erefore the Clenshaw algorithm can evaluate a polynomial in Legendre basis. e error analysis of the Clenshaw algorithm was considered in the literatures [610]. e relative accuracy bound of the computed values () by the Clenshaw algorithm verifies () − () () cond (, ) × () . (2) For ill-conditioned problems, several researches applied error-free transformations [11] to propose accurate com- pensated algorithms [1215] to evaluate the polynomials in monomial, Bernstein, and Chebyshev bases with Horner, de Casteljau, and Clenshaw algorithms, respectively. Some recent applications of high-precision arithmetic were given in [16]. Motivated by them, we apply error-free transformations to analyze the effect of round-off errors and then compensate them to the original result of the Clenshaw algorithm. Since the coefficients of the Legendre polynomial are fractions, the coefficient perturbations in the evaluation may exist when the coefficients are truncated to floating point num- bers. We store the coefficients which are not floating point numbers in double-double format, with the double working precision, to get the perturbation. We also compensate the approximate perturbed errors to the original result of the Clenshaw algorithm. Based on the above, we construct a compensated Clenshaw algorithm for the evaluation of a linear combination of Legendre polynomials, which can yield Hindawi Publishing Corporation Journal of Applied Mathematics Volume 2014, Article ID 742538, 13 pages http://dx.doi.org/10.1155/2014/742538

Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Research ArticleAccurate Evaluation of Polynomials in Legendre Basis

Peibing Du1 Hao Jiang2 and Lizhi Cheng1

1 Department of Mathematics and Systems Science College of Science National University of Defense TechnologyChangsha 410073 China

2The State Key Laboratory for High Performance Computation College of Computer ScienceNational University of Defense Technology Changsha 410073 China

Correspondence should be addressed to Peibing Du duli 0211foxmailcom

Received 22 April 2014 Accepted 2 July 2014 Published 23 July 2014

Academic Editor Roberto Barrio

Copyright copy 2014 Peibing Du et al This is an open access article distributed under the Creative Commons Attribution Licensewhich permits unrestricted use distribution and reproduction in any medium provided the original work is properly cited

This paper presents a compensated algorithm for accurate evaluation of a polynomial in Legendre basis Since the coefficientsof the evaluated polynomial are fractions we propose to store these coefficients in two floating point numbers such as double-double format to reduce the effect of the coefficientsrsquo perturbation The proposed algorithm is obtained by applying error-freetransformation to improve the Clenshaw algorithm It can yield a full working precision accuracy for the ill-conditioned polynomialevaluation Forward error analysis and numerical experiments illustrate the accuracy and efficiency of the algorithm

1 Introduction

Legendre polynomial is often used in numerical analysis[1ndash3] such as approximation theory and quadrature anddifferential equations Legendre polynomial satisfies 3-termrecurrence relation that is for Legendre polynomial 119901119896(119909)

1199010 (119909) = 1

1199011 (119909) = 119909

119901119896+1 (119909) =2119896 + 1

119896 + 1119909119901119896 (119909) minus

119896

119896 + 1119901119896minus1 (119909) (119896 gt 0)

(1)

The polynomial represented in Legendre basis is 119901(119909) =

sum119899

119895=0119886119895119901119895(119909) where 119886119895 isin R and 119901119895(119909) is Legendre polyno-

mialThe Clenshaw algorithm [4 5] is usually used to evaluate

a linear combination of Chebyshev polynomials but it canapply to any class of functions that can be defined bya three-term recurrence relation Therefore the Clenshawalgorithm can evaluate a polynomial in Legendre basis Theerror analysis of the Clenshaw algorithm was considered in

the literatures [6ndash10] The relative accuracy bound of thecomputed values 119901(119909) by the Clenshaw algorithm verifies

1003816100381610038161003816119901 (119909) minus 119901 (119909)1003816100381610038161003816

119901 (119909)le cond (119901 119909) times 119900 (119906) (2)

For ill-conditioned problems several researches appliederror-free transformations [11] to propose accurate com-pensated algorithms [12ndash15] to evaluate the polynomials inmonomial Bernstein and Chebyshev bases with Hornerde Casteljau and Clenshaw algorithms respectively Somerecent applications of high-precision arithmetic were givenin [16]

Motivated by them we apply error-free transformationsto analyze the effect of round-off errors and then compensatethem to the original result of the Clenshaw algorithm Sincethe coefficients of the Legendre polynomial are fractionsthe coefficient perturbations in the evaluation may existwhen the coefficients are truncated to floating point num-bers We store the coefficients which are not floating pointnumbers in double-double format with the double workingprecision to get the perturbation We also compensate theapproximate perturbed errors to the original result of theClenshaw algorithm Based on the above we construct acompensated Clenshaw algorithm for the evaluation of alinear combination of Legendre polynomials which can yield

Hindawi Publishing CorporationJournal of Applied MathematicsVolume 2014 Article ID 742538 13 pageshttpdxdoiorg1011552014742538

2 Journal of Applied Mathematics

a full working precision accuracy and its relative accuracybound satisfies

1003816100381610038161003816119901 (119909) minus 119901 (119909)1003816100381610038161003816

119901 (119909)le 119900 (119906) + cond (119901 119909) times 119900 (119906

2) (3)

The paper is organized as follows Section 2 shows somebasic notations in error analysis floating point arithmeticerror-free transformations compensated algorithm Clen-shaw algorithm and condition number Section 3 presentsthe compensated algorithm and its error bound Section 4gives several numerical experiments to illustrate the effi-ciency and accuracy of the compensated algorithm for poly-nomial in Legendre basis

2 Mathematical and ArithmeticalPreliminaries

21 Basic Notations and Definitions Throughout this paperwe assume to work with a floating point arithmetic adheringto IEEE-754 floating point standard in rounding to nearestand no overflow nor underflow occurs Let 119900119901 isin oplus ⊖ otimes ⊘

represent the floating point computation then the computa-tion obeys the model

119886 119900119901 119887 = (119886 ∘ 119887) (1 + 1205761) =(119886 ∘ 119887)

(1 + 1205762) (4)

where ∘ isin + minus times divide and |1205761| |1205762| le 119906 (119906 is the round-offunit) We also assume that the computed result of 119886 isin R

in floating point arithmetic is denoted by 119886 and the set ofall floating point numbers is denoted by F The followingdefinition will be used in error analysis (see more details in[17])

Definition 1 One defines

⟨119899⟩ =

119899

prod

119894=1

(1 + 120575119894)120588119894

= 1 + 120579119899 (5)

where |120575119894| le 119906 120588119894 = plusmn1 with forall119894 = 1 2 119899 |120579119899| le 120574119899 =

(119899119906(1 minus 119899119906)) = 119899119906 + 119874(1199062) and 119899119906 lt 1

There are three classic properties which will also be usedin error analysis

(i) ⟨119896⟩⟨119895⟩ = ⟨119896 + 119895⟩(ii) 120574119896 lt 120574119896+1(iii) 120574119896 + 120574119895 + 120574119896120574119895 le 120574119896+119895

22 Accurate Sum and Product Let 119886 119887 isin F and no overflownor underflow occurs The transformation (119886 119887) rarr (119909 119910)

is regarded as an error-free transformation (EFT) that causes119910 isin F to exist such that 119886 ∘ 119887 = 119909 + 119910 119909 = 119886 119900119901 119887

Let us show the error-free transformations of the sumand product of two floating point numbers in Algorithms 1-3 which are the 119879119908119900119878119906119898 algorithm by Knuth [18] and the119879119908119900119875119903119900119889 algorithm by Dekker [19] respectively

Algorithms 1ndash3 satisfy the Theorem 2

function [119909 119910] = 119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119911 = 119909 ⊖ 119886

119910 = (119886 ⊖ (119909 ⊖ 119911)) oplus (119887 ⊖ 119911)

Algorithm 1 Sum of two floating point numbers

function [119909 119910] = 119878119901119897119894119905(119886)

119888 = 119891119886119888119905119900119903 otimes 119886 (in double precision factor = 227

+ 1)119909 = 119888 ⊖ (119888 ⊖ 119886)

119910 = 119886 ⊖ 119909

Algorithm 2 Split of a floating point number into two parts

function [119909 119910] = 119879119908119900119875119903119900119889(119886 119887)

119909 = 119886 otimes 119887

[119886ℎ 119886119897] = 119878119901119897119894119905(119886)

[119887ℎ 119887119897] = 119878119901119897119894119905(119887)

119910 = 119886119897 otimes 119887119897 ⊖ (((119909 ⊖ 119886ℎ otimes 119887ℎ) ⊖ 119886119897 otimes 119887ℎ) ⊖ 119886ℎ otimes 119887119897)

Algorithm 3 Product of two floating point numbers

function [119909 119910] = 119879ℎ119903119890119890119875119903119900119889(119886 119887 119888)

[119905 ℎ] = 119879119908119900119875119903119900119889(119886 119887)

[119909 119890] = 119879119908119900119875119903119900119889(119905 119888)

119910 = 119888 otimes ℎ oplus 119890

Algorithm 4 Product of three floating point numbers

Theorem 2 (see [11]) For 119886 119887 isin F and 119909 119910 isin F 119879119908119900119878119906119898 and119879119908119900119875119903119900119889 verify

[119909 119910] = 119879119908119900119878119906119898 (119886 119887) 119909 + 119910 = 119886 + 119887

10038161003816100381610038161199101003816100381610038161003816 le min 119906 |119909| 119906 |119886 + 119887|

[119909 119910] = 119879119908119900119875119903119900119889 (119886 119887) 119909 + 119910 = 119886119887

10038161003816100381610038161199101003816100381610038161003816 le min 119906 |119909| 119906 |119886119887|

(6)

We present the compensated algorithm for the product ofthree floating point numbers in Algorithm 4 which refers to[20]

According to Theorem 2 we have |ℎ| le 119906|119886119887| and 119905 + ℎ =

119886119887 Hence |119890| le 119906|(119886119887 minus ℎ)119888| le 119906|119886119887119888| + 119906|ℎ119888| le 119906|119886119887119888| +

1199062|119886119887119888| then |119888ℎ + 119890| le |119888ℎ| + |119890| le 2119906|119886119887119888| + 119906

2|119886119887119888|

According to Lemma 32 in [20] we can propose the errorbound of Algorithm 4 inTheorem 3

Journal of Applied Mathematics 3

Theorem3 For 119886 119887 119888 isin F and 119909 119910 120591 isin F 119879ℎ119903119890119890119875119903119900119889 verifies

[119909 119910] = 119879ℎ119903119890119890119875119903119900119889 (119886 119887 119888) 119909 + 119910 = 119886119887119888 minus 120591

|120591| le 12057421205746 |119886119887119888| 1003816100381610038161003816119910

1003816100381610038161003816 le 2119906 |119886119887119888| + 141199062

|119886119887119888|

(7)

Proof According to Lemma 32 in [20] we have

|120591| le 12057421205746 |119886119887119888| (8)

In Algorithm 4 119910 + 120591 = 119888ℎ + 119890 then

10038161003816100381610038161199101003816100381610038161003816 =

1003816100381610038161003816119910 + 120591 minus 1205911003816100381610038161003816 le |119888ℎ + 119890| + |120591|

le 2119906 |119886119887119888| + 1199062

|119886119887119888| + 12057421205746 |119886119887119888|

le 2119906 |119886119887119888| + 141199062

|119886119887119888|

(9)

23 The Clenshaw Algorithm and Condition Number Thestandard general algorithm for the evaluation of polynomialin Legendre basis 119901(119909) = sum

119899

119895=0119886119895119901119895(119909) is the Clenshaw

algorithm [5] We recall it in Algorithm 5Barrio et al [21] proposed a general polynomial condi-

tion number for any polynomial basis defined by a linearrecurrence and used this new condition number to give theerror bounds for the Clenshaw algorithm Based on thisgeneral condition number we propose the absolute Legendrepolynomial which is similar to the absolute polynomialmentioned in [7 21]

Definition 4 Let 119901119896(119909) be Legendre polynomial We definethe absolute Legendre polynomial 119901119896(119909) which is associatedwith 119901119896(119909) and satisfies

1199010 (119909) = 1

1199011 (119909) = 119909

119901119896 (119909) =2119896 minus 1

119896119909119901119896minus1 (119909) +

119896

119896 + 1119901119896minus2 (119909) (119896 ge 2)

(10)

where |119901119896(119909)| le 119901119896(119909) forall119909 ge 0

The absolute Legendre polynomial satisfies the followingproperty

Lemma 5 Let 119901119896(119909) be the absolute Legendre polynomialThen we have

119901119896 (119909) 119901119895 (119909) le 119901119896+119895 (119909) (11)

Proof Let119860119896 = (2119896+1)(119896+1) and 119896 ge 2 FromDefinition 4we have

119901119896 (119909) = 119860119896minus1119909119901119896minus1 (119909) +119896

119896 + 1119901119896minus2 (119909)

= (

119896minus1

prod

119894=0

119860 119894) 119909119896

+ sdot sdot sdot

(12)

function 119901(119909) = 119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

119887119895 =2119895 + 1

119895 + 1119909119887119895+1 minus

119895 + 1

119895 + 2119887119895+2 + 119886119895

end119901(119909) = 1198870

Algorithm 5 The Clenshaw algorithm for finite Legendre series

then

119901119896 (119909) 119901119895 (119909) = (

119896minus1

prod

119894=0

119860 119894) (

119895minus1

prod

119894=0

119860 119894) 119909119896+119895

+ sdot sdot sdot (13)

Thus the equivalent form of (11) is

(

119896minus1

prod

119894=0

119860 119894) (

119895minus1

prod

119894=0

119860 119894) le

119896+119895minus1

prod

119894=0

119860 119894 (14)

Since 119860119896 is increasing with 119896 we obtain

119895minus1

prod

119894=0

119860 119894 le

119896+119895minus1

prod

119894=119896

119860 119894 (15)

So we finally obtain 119901119896(119909)119901119895(119909) le 119901119896+119895(119909)

Following Definition 4 we introduce the condition num-ber for the evaluation of polynomials in Legendre basis [21]

Definition 6 Let 119901(119909) = sum119899

119896=0119886119896119901119896(119909) where 119901119896(119909) is

Legendre polynomial Let 119901119896(119909) be the absolute Legendrepolynomial Then the absolute condition number is

condabs (119901 119909) = 119901 (|119909|) =

119899

sum

119896=0

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|) (16)

and the relative condition number is

condrel (119901 119909) =119901 (|119909|)1003816100381610038161003816119901 (119909)

1003816100381610038161003816

=sum119899

119896=0

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

1003816100381610038161003816119901 (119909)1003816100381610038161003816

(17)

3 Compensated Algorithm forEvaluating Polynomials

In this section we exhibit the exact round-off errors gener-ated by the Clenshaw algorithm with EFT We also analyzethe perturbations generated by truncating the fractions inAlgorithm 5Wepropose a compensatedClenshaw algorithmto evaluate finite Legendre series and present its error boundin the following

Firstly in order to analyze the perturbations we split eachcoefficient into three parts as follows

119860 = 119860(ℎ)

+ 119860(119897)

+ 119860(119898)

(18)

4 Journal of Applied Mathematics

where119860(ℎ)

119860(119897)

isin F 119860 119860(119898)

isin R and |119860(119897)

| le 119906|119860(ℎ)

| |119860(119898)

| le

119906|119860(119897)

| Let 119860119896 = (2119896 + 1)(119896 + 1) and 119862119896 = minus(119896(119896 + 1)) Thenwe describe the recurrence relation at 119895th step of Algorithm 5for theoretical computation as

119887119895 = (A(ℎ)119895

+ 119860(119897)

119895+ 119860(119898)

119895) 119909119887119895+1

+ (119862(ℎ)

119895+1+ 119862(119897)

119895+1+ 119862(119898)

119895+1) 119887119895+2

+ (119886(ℎ)

119895+ 119886(119897)

119895+ 119886(119898)

119895)

(19)

For numerical computation associated with (19) it is

119895 = 119860(ℎ)

119895otimes 119909 otimes 119895+1 oplus 119862

(ℎ)

119895+1otimes 119895+2 oplus 119886

(ℎ)

119895 (20)

Remark 7 Let 119860 isin R We split a coefficient 119860 like (18) thenthe representation of splitting is unique and 119860 = 119860

(ℎ)oplus 119860(119897)

119860 = 119860⟨1⟩

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 Since every

elementary floating point operation in Algorithm 5 causesround-off errors in numerical computation we apply 119864119865119879

and the 119879ℎ119903119890119890119875119903119900119889 algorithms to take notes of all round-offerrors and obtain

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889 (119860(ℎ)

119895 119909 119895+1)

[119904 120573119895] = 119879119908119900119875119903119900119889 (119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898 (119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898 (119905 119886(ℎ)

119895)

(21)

The sum of the perturbation and the round-off errors of therecurrence relation at 119895th step is

119908119895 = (119860(119897)

119895+ 119860(119898)

119895) 119909119895+1 + (119862

(119897)

119895+1+ 119862(119898)

119895+1) 119895+2

+ (119886(119897)

119895+ 119886(119898)

119895) + 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895

(22)

where 119903+120572119895+120591119895 = 119860(ℎ)

119895119909119895+1 120591119895 is defined inTheorem 3Then

we obtain the following theorem

Theorem 8 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and let 119909 be a floating point value One assumes that119860119895 = 119860

(ℎ)

119895and119862119895 = 119862

(ℎ)

119895inAlgorithm 5 and 0 is the numerical

result 119908119895 is described in (22) for 119895 = 0 1 119899 minus 1 Then oneobtains

119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (23)

Proof The perturbation of Algorithm 5 is

(119860(119897)

119895+ 119860(119898)

j ) 119909119895+1 + (119862(119897)

119895+1+ 119862(119898)

119895+1) 119895+2 + (119886

(119897)

119895+ 119886(119898)

119895)

(24)

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 FromTheorems

2ndash3 and (21) we can easily obtain

119860(ℎ)

119895119895+1119909 = 119903 + 120572119895 + 120591119895

119862(ℎ)

119895+1119895+2 = 119904 + 120573119895

119903 + 119904 = 119905 + 120578119895

119905 + 119886(ℎ)

119895= 119895 + 120585119895

(25)

Let 119904119895 = 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895 for 119895 = 0 1 119899 minus 1 then

119895 + 119904119895 = 119860(ℎ)

119895119895+1119909 + 119862

(ℎ)

119895+1119895+2 + 119886

(ℎ)

119895 119895 = 0 1 119899 minus 1

(26)

From (18) (19) (22) and (24) we have

119895 + 119908119895 = 119860119895119895+1119909 + 119862119895+1119895+2 + 119886119895 119895 = 0 1 119899 minus 1

(27)

Thus

0 =

119899

sum

119895=0

(119886119895 minus 119908119895) 119901119895 (119909) (28)

then119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (29)

To devise a compensated algorithm of Algorithm 5 andgive its error bound we need the following lemmas

Lemma 9 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 119909 a floating point value and 0 the numerical resultof Algorithm 5 Then

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816 le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (30)

Proof Applying the standard model of floating point arith-metic from Algorithm 5 and Remark 7 we have

119899minus1 = 119860119899minus1119899119909 ⟨4⟩ + 119886119899minus1 ⟨1⟩

119899minus2 = 119860119899minus2119899minus1119909 ⟨5⟩ + 119862119899minus1119899 ⟨4⟩ + 119886119899minus2 ⟨1⟩

0 = 11986001119909 ⟨5⟩ + 11986212 ⟨4⟩ + 1198860 ⟨1⟩

(31)

Thus we obtain

0 = ⟨4 + 5 (119899 minus 1)⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

= ⟨5119899 minus 1⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

(32)

Journal of Applied Mathematics 5

function 119903119890119904 = 119862119900119898119901119862119897119890119899119904ℎ119886119908(119901 119909)

119899+2 = 119899+1 = 0

120598119899+2 = 120598119899+1 = 0

for 119895 = 119899 minus1 0

[119860(ℎ)

119895 119860(119897)

119895] = 119889119894V 119889 119889(2119895 + 1 119895 + 1)

[119862(ℎ)

119895 119862(119897)

119895] = 119889119894V 119889 119889(minus119895 minus 1 119895 + 2)

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889(119860(ℎ)

119895 119895+1 119909)

[119904 120573119895] = 119879119908119900119875119903119900119889(119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898(119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898(119905 119886

119895)

119904119895 = 120572119895 oplus 120573119895 oplus 120578119895 oplus 120585119895 oplus (119860(119897)

119895otimes 119909 otimes 119895+1 oplus 119862

(119897)

119895+1otimes 119895+2 oplus 119886

(119897)

119895)

120598119895 = 119860(ℎ)

119895otimes 119909 otimes 120598119895+1 oplus 119862

(ℎ)

119895+1otimes 120598119895+2 oplus 119904119895

end119903119890119904 = 119910 oplus 1205980

Algorithm 6 Compensated Clenshaw algorithm

function 119887 = 119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887(119899)

0= 119886119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

119887(119895)

0= 119886119895 minus

1198621

1198601119887(119895+1)

1(119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1minus

119862119896+1

119860119896+1119887(119895+1)

119896+1(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1(119896 ge 119899 minus 119895 minus 1)

endend119887 = 119887(0)

Algorithm 7 The conversion algorithm from power basis to Legendre basis

Then from Definition 1 we get

100381610038161003816100381610038160 minus 119901 (119909)

10038161003816100381610038161003816=

1003816100381610038161003816100381610038161003816100381610038161003816

(

119899minus1

prod

119894=0

119860 119894) 1199091198991198861198991205795119899minus1 + sdot sdot sdot + 11988601205791

1003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1((

119899minus1

prod

119894=0

119860 119894) |119909|119899 1003816100381610038161003816119886119899

1003816100381610038161003816 + sdot sdot sdot +10038161003816100381610038161198860

1003816100381610038161003816)

= 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119895 (|119909|)

(33)

Lemma 10 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value We assume that 120590119895 le

120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) where 120596119895 is real numbersthen

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (34)

Proof According to (31) we get

10038161003816100381610038161003816119895

10038161003816100381610038161003816le (1 + 1205745) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (35)

Since 120590119895 le 120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) fromDefinition 1 we have

120590119895 le 120596119895 (1 + 1205745(119899minus119895minus1)) Σ119899

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|) (36)

6 Journal of Applied Mathematics

function [119909 119910] = 119865119886119904119905119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119910 = (119886 ⊖ 119909) oplus 119887

Algorithm 8 EFT of the sum of two floating point numbers (|119886| ge

|119887|)

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886ℎ 119887)

119905119897 = 119886119897 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 9 Addition of a double-double number and a doublenumber

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119904ℎ 119904119897] = 119879119908119900119878119906119898(119886ℎ 119887ℎ)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886119897 119887119897)

119904119897 = 119904119897 oplus 119905ℎ

119905ℎ = 119904ℎ oplus 119904119897

119904119897 = 119904119897 ⊖ (119905ℎ ⊖ 119904ℎ)

119905119897 = 119905119897 oplus 119904119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 10 Addition of a double-double number and a double-double number

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887)

119905119897 = 119886119897 otimes 119887 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 11 Multiplication of a double-double number by adouble number

then119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

times

119899minus1

sum

119895=0

(

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|)) 119901119895 (|119909|)

(37)

According to Lemma 5 we obtain

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

119899minus1

sum

119895=0

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(38)

Among the perturbed and round-off errors inAlgorithm 5 we deem that some errors do not influence thenumerical result in working precision Now we can give theperturbed error bounds and the round-off error boundsrespectively At first we analyze the perturbed error in (24)Let 119892(119897)

119895= 119860(119897)

119895119909119895+1+119862

(119897)

119895+1119895+2+119886

(119897)

119895 According to119860

(119897)le 119906119860(ℎ)

and Remark 7 we obtain10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816le 119906 (1 + 1205741) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (39)

Then let 120596119895 = 119906(1 + 1205741) and from Lemma 10 taking intoaccount that (119899+1)119906(1+1205745119899+1) le (5119899+1)119906(1+1205745119899+1) = 1205745119899+1we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (40)

1205745119899+1 is 119874(119906) so this coefficient perturbation may influ-ence the accuracy we need to consider it in our compensatedalgorithm

Similarly we let 119892(119898)

119895= 119860(119898)

119895119909119895+1 + 119862

(119898)

119895+1119895+2 + 119886

(119898)

119895 then

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119898)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1199061205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (41)

1199061205745119899+1 is 119874(1199062) so this coefficient perturbation does not

influence the accuracy

Remark 11 When 119895 = 119899 the 119899th step of Algorithm 5 is119899 = 119886

(ℎ)

119899 so that we only need to consider the perturbation

of coefficient 119886119899

Next we deduce the round-off error bound Let 119904119895 = 120572119895 +

120573119895 + 120578119895 + 120585119895 According to Theorems 2 and 3 and Remark 7we obtain

10038161003816100381610038161003816120572119895

10038161003816100381610038161003816le (2119906 + 14119906

2)

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1

10038161003816100381610038161003816

le (2119906 + 141199062) (1 + 1205741)

10038161003816100381610038161003816119860119895119909119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119862(ℎ)

119895+1119895+2

10038161003816100381610038161003816le 119906 (1 + 1205741)

10038161003816100381610038161003816119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨3⟩ + 119862

(ℎ)

119895+1119895+2 ⟨2⟩

10038161003816100381610038161003816

le 119906 (1 + 1205743)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨4⟩ + 119862

(ℎ)

119895+1119895+2 ⟨3⟩ + 119886119895 ⟨1⟩

10038161003816100381610038161003816

le 119906 (1 + 1205744)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2 + 119886119895

10038161003816100381610038161003816

(42)

then10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816

le (4119906 + 141199062)

10038161003816100381610038161 + 12057441003816100381610038161003816

times (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(43)

Journal of Applied Mathematics 7

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887ℎ)

119905119897 = (119886ℎ otimes 119887119897) oplus (119886119897 otimes 119887ℎ) oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 12 Multiplication of a double-double number by adouble-double number

function [119903ℎ 119903119897] = 119889119894V 119889 119889(119886 119887)

119902ℎ = 119886 ⊘ 119887

[119905ℎ1 1199051198971] = 119879119908119900119875119903119900119889(119902ℎ 119887)

[119905ℎ2 1199051198972] = 119879119908119900119878119906119898(119886 minus119905ℎ1)

119902119897 = (119905ℎ2 oplus 1199051198972 ⊖ 1199051198971) ⊘ 119887

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119902ℎ 119902119897)

Algorithm 13 Division of a double number by a double number

Let 120596119895 = (4119906 + 141199062)|1 + 1205744| and using it into Lemma 10

from (4+14119906)119899119906(1+1205745119899minus1) le (5119899minus1)119906(1+1205745119899minus1) = 1205745119899minus1 (119899 ge

2) we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(44)

1205745119899minus1 is 119874(119906) so this round-off error may influence theaccuracy we also need to consider it in our compensatedalgorithm

From Theorem 3 we have known that round-off error|120591119895| le 12057421205746|119860

(ℎ)

119895119909119895+1| le 12057421205746(1 + 1205741)|119860119895119909119895+1| According to

Lemma 10 we let 120596119895 = 12057421205746(1 + 1205741) from 1205742 le 2119906(1 + 1205741) and2119899119906(1 + 1205745119899minus3) le 1205745119899minus3 we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

10038161003816100381610038161003816100381610038161003816100381610038161003816

12059111989510038161003816100381610038161003816119901119895 (119909)

10038161003816100381610038161003816le 12057461205745119899minus3

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (45)

12057461205745119899minus3 is119874(1199062) so this round-off error does not influence

the accuracyObserving the error bounds we described above the

perturbation generated by the third part of coefficients in(18) does not influence the accuracy Thanks to the 119889119894V 119889 119889

algorithm in Appendix B (see Algorithm 13) we only need tosplit the coefficients into two floating point numbers

Applying EFT the 119879ℎ119903119890119890119875119903119900119889 algorithm and the 119889119894V 119889 119889

algorithm considering all errors which may influence thenumerical result in working precision in Algorithm 5 weobtain the compensated Clenshaw algorithm in Algorithm 6

Here we give the error bound of Algorithm 6

Theorem 12 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 (119899 ge 2) and119909 a floating point valueThe forward errorbound of the compensated Clenshaw algorithm is

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

le 1199061003816100381610038161003816119901 (119909)

1003816100381610038161003816 + 21205742

5119899minus2

119899

sum

119895=0

119886119895119875119895 (119909) (46)

Proof From Algorithm 6 we obtain

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(0 oplus 1205980) minus 119901 (119909)

10038161003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (0 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

(47)

where |120598| le 119906According toTheorem 8 we have 119901(119909) = 119900 + 120598119887119900 then

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (119875 (119909) minus 120598119887119900 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

le 119906 |119875 (119909)| + (1 + 119906)10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816

(48)

Next we analyze the bound of |120598119887119900 minus 1205980|Let 119892(119897)

119895= 119860(119897)

119895119909119895+1 + 119862

(119897)

119895+1119895+2 + 119886

(119897)

119895 then

119892(119897)

119895= 119860(119897)

119895119909119895+1 ⟨4⟩ + 119862

(119897)

119895+1119895+2 ⟨3⟩ + 119886

(119897)

119895⟨1⟩ (49)

Thus we obtain

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205744

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(50)

According to Lemma 9 we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745119899minus1 (1 + 1205744)

times

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816a(119897)119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(51)

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 2: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

2 Journal of Applied Mathematics

a full working precision accuracy and its relative accuracybound satisfies

1003816100381610038161003816119901 (119909) minus 119901 (119909)1003816100381610038161003816

119901 (119909)le 119900 (119906) + cond (119901 119909) times 119900 (119906

2) (3)

The paper is organized as follows Section 2 shows somebasic notations in error analysis floating point arithmeticerror-free transformations compensated algorithm Clen-shaw algorithm and condition number Section 3 presentsthe compensated algorithm and its error bound Section 4gives several numerical experiments to illustrate the effi-ciency and accuracy of the compensated algorithm for poly-nomial in Legendre basis

2 Mathematical and ArithmeticalPreliminaries

21 Basic Notations and Definitions Throughout this paperwe assume to work with a floating point arithmetic adheringto IEEE-754 floating point standard in rounding to nearestand no overflow nor underflow occurs Let 119900119901 isin oplus ⊖ otimes ⊘

represent the floating point computation then the computa-tion obeys the model

119886 119900119901 119887 = (119886 ∘ 119887) (1 + 1205761) =(119886 ∘ 119887)

(1 + 1205762) (4)

where ∘ isin + minus times divide and |1205761| |1205762| le 119906 (119906 is the round-offunit) We also assume that the computed result of 119886 isin R

in floating point arithmetic is denoted by 119886 and the set ofall floating point numbers is denoted by F The followingdefinition will be used in error analysis (see more details in[17])

Definition 1 One defines

⟨119899⟩ =

119899

prod

119894=1

(1 + 120575119894)120588119894

= 1 + 120579119899 (5)

where |120575119894| le 119906 120588119894 = plusmn1 with forall119894 = 1 2 119899 |120579119899| le 120574119899 =

(119899119906(1 minus 119899119906)) = 119899119906 + 119874(1199062) and 119899119906 lt 1

There are three classic properties which will also be usedin error analysis

(i) ⟨119896⟩⟨119895⟩ = ⟨119896 + 119895⟩(ii) 120574119896 lt 120574119896+1(iii) 120574119896 + 120574119895 + 120574119896120574119895 le 120574119896+119895

22 Accurate Sum and Product Let 119886 119887 isin F and no overflownor underflow occurs The transformation (119886 119887) rarr (119909 119910)

is regarded as an error-free transformation (EFT) that causes119910 isin F to exist such that 119886 ∘ 119887 = 119909 + 119910 119909 = 119886 119900119901 119887

Let us show the error-free transformations of the sumand product of two floating point numbers in Algorithms 1-3 which are the 119879119908119900119878119906119898 algorithm by Knuth [18] and the119879119908119900119875119903119900119889 algorithm by Dekker [19] respectively

Algorithms 1ndash3 satisfy the Theorem 2

function [119909 119910] = 119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119911 = 119909 ⊖ 119886

119910 = (119886 ⊖ (119909 ⊖ 119911)) oplus (119887 ⊖ 119911)

Algorithm 1 Sum of two floating point numbers

function [119909 119910] = 119878119901119897119894119905(119886)

119888 = 119891119886119888119905119900119903 otimes 119886 (in double precision factor = 227

+ 1)119909 = 119888 ⊖ (119888 ⊖ 119886)

119910 = 119886 ⊖ 119909

Algorithm 2 Split of a floating point number into two parts

function [119909 119910] = 119879119908119900119875119903119900119889(119886 119887)

119909 = 119886 otimes 119887

[119886ℎ 119886119897] = 119878119901119897119894119905(119886)

[119887ℎ 119887119897] = 119878119901119897119894119905(119887)

119910 = 119886119897 otimes 119887119897 ⊖ (((119909 ⊖ 119886ℎ otimes 119887ℎ) ⊖ 119886119897 otimes 119887ℎ) ⊖ 119886ℎ otimes 119887119897)

Algorithm 3 Product of two floating point numbers

function [119909 119910] = 119879ℎ119903119890119890119875119903119900119889(119886 119887 119888)

[119905 ℎ] = 119879119908119900119875119903119900119889(119886 119887)

[119909 119890] = 119879119908119900119875119903119900119889(119905 119888)

119910 = 119888 otimes ℎ oplus 119890

Algorithm 4 Product of three floating point numbers

Theorem 2 (see [11]) For 119886 119887 isin F and 119909 119910 isin F 119879119908119900119878119906119898 and119879119908119900119875119903119900119889 verify

[119909 119910] = 119879119908119900119878119906119898 (119886 119887) 119909 + 119910 = 119886 + 119887

10038161003816100381610038161199101003816100381610038161003816 le min 119906 |119909| 119906 |119886 + 119887|

[119909 119910] = 119879119908119900119875119903119900119889 (119886 119887) 119909 + 119910 = 119886119887

10038161003816100381610038161199101003816100381610038161003816 le min 119906 |119909| 119906 |119886119887|

(6)

We present the compensated algorithm for the product ofthree floating point numbers in Algorithm 4 which refers to[20]

According to Theorem 2 we have |ℎ| le 119906|119886119887| and 119905 + ℎ =

119886119887 Hence |119890| le 119906|(119886119887 minus ℎ)119888| le 119906|119886119887119888| + 119906|ℎ119888| le 119906|119886119887119888| +

1199062|119886119887119888| then |119888ℎ + 119890| le |119888ℎ| + |119890| le 2119906|119886119887119888| + 119906

2|119886119887119888|

According to Lemma 32 in [20] we can propose the errorbound of Algorithm 4 inTheorem 3

Journal of Applied Mathematics 3

Theorem3 For 119886 119887 119888 isin F and 119909 119910 120591 isin F 119879ℎ119903119890119890119875119903119900119889 verifies

[119909 119910] = 119879ℎ119903119890119890119875119903119900119889 (119886 119887 119888) 119909 + 119910 = 119886119887119888 minus 120591

|120591| le 12057421205746 |119886119887119888| 1003816100381610038161003816119910

1003816100381610038161003816 le 2119906 |119886119887119888| + 141199062

|119886119887119888|

(7)

Proof According to Lemma 32 in [20] we have

|120591| le 12057421205746 |119886119887119888| (8)

In Algorithm 4 119910 + 120591 = 119888ℎ + 119890 then

10038161003816100381610038161199101003816100381610038161003816 =

1003816100381610038161003816119910 + 120591 minus 1205911003816100381610038161003816 le |119888ℎ + 119890| + |120591|

le 2119906 |119886119887119888| + 1199062

|119886119887119888| + 12057421205746 |119886119887119888|

le 2119906 |119886119887119888| + 141199062

|119886119887119888|

(9)

23 The Clenshaw Algorithm and Condition Number Thestandard general algorithm for the evaluation of polynomialin Legendre basis 119901(119909) = sum

119899

119895=0119886119895119901119895(119909) is the Clenshaw

algorithm [5] We recall it in Algorithm 5Barrio et al [21] proposed a general polynomial condi-

tion number for any polynomial basis defined by a linearrecurrence and used this new condition number to give theerror bounds for the Clenshaw algorithm Based on thisgeneral condition number we propose the absolute Legendrepolynomial which is similar to the absolute polynomialmentioned in [7 21]

Definition 4 Let 119901119896(119909) be Legendre polynomial We definethe absolute Legendre polynomial 119901119896(119909) which is associatedwith 119901119896(119909) and satisfies

1199010 (119909) = 1

1199011 (119909) = 119909

119901119896 (119909) =2119896 minus 1

119896119909119901119896minus1 (119909) +

119896

119896 + 1119901119896minus2 (119909) (119896 ge 2)

(10)

where |119901119896(119909)| le 119901119896(119909) forall119909 ge 0

The absolute Legendre polynomial satisfies the followingproperty

Lemma 5 Let 119901119896(119909) be the absolute Legendre polynomialThen we have

119901119896 (119909) 119901119895 (119909) le 119901119896+119895 (119909) (11)

Proof Let119860119896 = (2119896+1)(119896+1) and 119896 ge 2 FromDefinition 4we have

119901119896 (119909) = 119860119896minus1119909119901119896minus1 (119909) +119896

119896 + 1119901119896minus2 (119909)

= (

119896minus1

prod

119894=0

119860 119894) 119909119896

+ sdot sdot sdot

(12)

function 119901(119909) = 119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

119887119895 =2119895 + 1

119895 + 1119909119887119895+1 minus

119895 + 1

119895 + 2119887119895+2 + 119886119895

end119901(119909) = 1198870

Algorithm 5 The Clenshaw algorithm for finite Legendre series

then

119901119896 (119909) 119901119895 (119909) = (

119896minus1

prod

119894=0

119860 119894) (

119895minus1

prod

119894=0

119860 119894) 119909119896+119895

+ sdot sdot sdot (13)

Thus the equivalent form of (11) is

(

119896minus1

prod

119894=0

119860 119894) (

119895minus1

prod

119894=0

119860 119894) le

119896+119895minus1

prod

119894=0

119860 119894 (14)

Since 119860119896 is increasing with 119896 we obtain

119895minus1

prod

119894=0

119860 119894 le

119896+119895minus1

prod

119894=119896

119860 119894 (15)

So we finally obtain 119901119896(119909)119901119895(119909) le 119901119896+119895(119909)

Following Definition 4 we introduce the condition num-ber for the evaluation of polynomials in Legendre basis [21]

Definition 6 Let 119901(119909) = sum119899

119896=0119886119896119901119896(119909) where 119901119896(119909) is

Legendre polynomial Let 119901119896(119909) be the absolute Legendrepolynomial Then the absolute condition number is

condabs (119901 119909) = 119901 (|119909|) =

119899

sum

119896=0

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|) (16)

and the relative condition number is

condrel (119901 119909) =119901 (|119909|)1003816100381610038161003816119901 (119909)

1003816100381610038161003816

=sum119899

119896=0

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

1003816100381610038161003816119901 (119909)1003816100381610038161003816

(17)

3 Compensated Algorithm forEvaluating Polynomials

In this section we exhibit the exact round-off errors gener-ated by the Clenshaw algorithm with EFT We also analyzethe perturbations generated by truncating the fractions inAlgorithm 5Wepropose a compensatedClenshaw algorithmto evaluate finite Legendre series and present its error boundin the following

Firstly in order to analyze the perturbations we split eachcoefficient into three parts as follows

119860 = 119860(ℎ)

+ 119860(119897)

+ 119860(119898)

(18)

4 Journal of Applied Mathematics

where119860(ℎ)

119860(119897)

isin F 119860 119860(119898)

isin R and |119860(119897)

| le 119906|119860(ℎ)

| |119860(119898)

| le

119906|119860(119897)

| Let 119860119896 = (2119896 + 1)(119896 + 1) and 119862119896 = minus(119896(119896 + 1)) Thenwe describe the recurrence relation at 119895th step of Algorithm 5for theoretical computation as

119887119895 = (A(ℎ)119895

+ 119860(119897)

119895+ 119860(119898)

119895) 119909119887119895+1

+ (119862(ℎ)

119895+1+ 119862(119897)

119895+1+ 119862(119898)

119895+1) 119887119895+2

+ (119886(ℎ)

119895+ 119886(119897)

119895+ 119886(119898)

119895)

(19)

For numerical computation associated with (19) it is

119895 = 119860(ℎ)

119895otimes 119909 otimes 119895+1 oplus 119862

(ℎ)

119895+1otimes 119895+2 oplus 119886

(ℎ)

119895 (20)

Remark 7 Let 119860 isin R We split a coefficient 119860 like (18) thenthe representation of splitting is unique and 119860 = 119860

(ℎ)oplus 119860(119897)

119860 = 119860⟨1⟩

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 Since every

elementary floating point operation in Algorithm 5 causesround-off errors in numerical computation we apply 119864119865119879

and the 119879ℎ119903119890119890119875119903119900119889 algorithms to take notes of all round-offerrors and obtain

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889 (119860(ℎ)

119895 119909 119895+1)

[119904 120573119895] = 119879119908119900119875119903119900119889 (119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898 (119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898 (119905 119886(ℎ)

119895)

(21)

The sum of the perturbation and the round-off errors of therecurrence relation at 119895th step is

119908119895 = (119860(119897)

119895+ 119860(119898)

119895) 119909119895+1 + (119862

(119897)

119895+1+ 119862(119898)

119895+1) 119895+2

+ (119886(119897)

119895+ 119886(119898)

119895) + 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895

(22)

where 119903+120572119895+120591119895 = 119860(ℎ)

119895119909119895+1 120591119895 is defined inTheorem 3Then

we obtain the following theorem

Theorem 8 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and let 119909 be a floating point value One assumes that119860119895 = 119860

(ℎ)

119895and119862119895 = 119862

(ℎ)

119895inAlgorithm 5 and 0 is the numerical

result 119908119895 is described in (22) for 119895 = 0 1 119899 minus 1 Then oneobtains

119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (23)

Proof The perturbation of Algorithm 5 is

(119860(119897)

119895+ 119860(119898)

j ) 119909119895+1 + (119862(119897)

119895+1+ 119862(119898)

119895+1) 119895+2 + (119886

(119897)

119895+ 119886(119898)

119895)

(24)

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 FromTheorems

2ndash3 and (21) we can easily obtain

119860(ℎ)

119895119895+1119909 = 119903 + 120572119895 + 120591119895

119862(ℎ)

119895+1119895+2 = 119904 + 120573119895

119903 + 119904 = 119905 + 120578119895

119905 + 119886(ℎ)

119895= 119895 + 120585119895

(25)

Let 119904119895 = 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895 for 119895 = 0 1 119899 minus 1 then

119895 + 119904119895 = 119860(ℎ)

119895119895+1119909 + 119862

(ℎ)

119895+1119895+2 + 119886

(ℎ)

119895 119895 = 0 1 119899 minus 1

(26)

From (18) (19) (22) and (24) we have

119895 + 119908119895 = 119860119895119895+1119909 + 119862119895+1119895+2 + 119886119895 119895 = 0 1 119899 minus 1

(27)

Thus

0 =

119899

sum

119895=0

(119886119895 minus 119908119895) 119901119895 (119909) (28)

then119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (29)

To devise a compensated algorithm of Algorithm 5 andgive its error bound we need the following lemmas

Lemma 9 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 119909 a floating point value and 0 the numerical resultof Algorithm 5 Then

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816 le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (30)

Proof Applying the standard model of floating point arith-metic from Algorithm 5 and Remark 7 we have

119899minus1 = 119860119899minus1119899119909 ⟨4⟩ + 119886119899minus1 ⟨1⟩

119899minus2 = 119860119899minus2119899minus1119909 ⟨5⟩ + 119862119899minus1119899 ⟨4⟩ + 119886119899minus2 ⟨1⟩

0 = 11986001119909 ⟨5⟩ + 11986212 ⟨4⟩ + 1198860 ⟨1⟩

(31)

Thus we obtain

0 = ⟨4 + 5 (119899 minus 1)⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

= ⟨5119899 minus 1⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

(32)

Journal of Applied Mathematics 5

function 119903119890119904 = 119862119900119898119901119862119897119890119899119904ℎ119886119908(119901 119909)

119899+2 = 119899+1 = 0

120598119899+2 = 120598119899+1 = 0

for 119895 = 119899 minus1 0

[119860(ℎ)

119895 119860(119897)

119895] = 119889119894V 119889 119889(2119895 + 1 119895 + 1)

[119862(ℎ)

119895 119862(119897)

119895] = 119889119894V 119889 119889(minus119895 minus 1 119895 + 2)

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889(119860(ℎ)

119895 119895+1 119909)

[119904 120573119895] = 119879119908119900119875119903119900119889(119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898(119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898(119905 119886

119895)

119904119895 = 120572119895 oplus 120573119895 oplus 120578119895 oplus 120585119895 oplus (119860(119897)

119895otimes 119909 otimes 119895+1 oplus 119862

(119897)

119895+1otimes 119895+2 oplus 119886

(119897)

119895)

120598119895 = 119860(ℎ)

119895otimes 119909 otimes 120598119895+1 oplus 119862

(ℎ)

119895+1otimes 120598119895+2 oplus 119904119895

end119903119890119904 = 119910 oplus 1205980

Algorithm 6 Compensated Clenshaw algorithm

function 119887 = 119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887(119899)

0= 119886119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

119887(119895)

0= 119886119895 minus

1198621

1198601119887(119895+1)

1(119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1minus

119862119896+1

119860119896+1119887(119895+1)

119896+1(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1(119896 ge 119899 minus 119895 minus 1)

endend119887 = 119887(0)

Algorithm 7 The conversion algorithm from power basis to Legendre basis

Then from Definition 1 we get

100381610038161003816100381610038160 minus 119901 (119909)

10038161003816100381610038161003816=

1003816100381610038161003816100381610038161003816100381610038161003816

(

119899minus1

prod

119894=0

119860 119894) 1199091198991198861198991205795119899minus1 + sdot sdot sdot + 11988601205791

1003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1((

119899minus1

prod

119894=0

119860 119894) |119909|119899 1003816100381610038161003816119886119899

1003816100381610038161003816 + sdot sdot sdot +10038161003816100381610038161198860

1003816100381610038161003816)

= 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119895 (|119909|)

(33)

Lemma 10 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value We assume that 120590119895 le

120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) where 120596119895 is real numbersthen

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (34)

Proof According to (31) we get

10038161003816100381610038161003816119895

10038161003816100381610038161003816le (1 + 1205745) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (35)

Since 120590119895 le 120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) fromDefinition 1 we have

120590119895 le 120596119895 (1 + 1205745(119899minus119895minus1)) Σ119899

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|) (36)

6 Journal of Applied Mathematics

function [119909 119910] = 119865119886119904119905119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119910 = (119886 ⊖ 119909) oplus 119887

Algorithm 8 EFT of the sum of two floating point numbers (|119886| ge

|119887|)

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886ℎ 119887)

119905119897 = 119886119897 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 9 Addition of a double-double number and a doublenumber

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119904ℎ 119904119897] = 119879119908119900119878119906119898(119886ℎ 119887ℎ)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886119897 119887119897)

119904119897 = 119904119897 oplus 119905ℎ

119905ℎ = 119904ℎ oplus 119904119897

119904119897 = 119904119897 ⊖ (119905ℎ ⊖ 119904ℎ)

119905119897 = 119905119897 oplus 119904119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 10 Addition of a double-double number and a double-double number

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887)

119905119897 = 119886119897 otimes 119887 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 11 Multiplication of a double-double number by adouble number

then119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

times

119899minus1

sum

119895=0

(

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|)) 119901119895 (|119909|)

(37)

According to Lemma 5 we obtain

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

119899minus1

sum

119895=0

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(38)

Among the perturbed and round-off errors inAlgorithm 5 we deem that some errors do not influence thenumerical result in working precision Now we can give theperturbed error bounds and the round-off error boundsrespectively At first we analyze the perturbed error in (24)Let 119892(119897)

119895= 119860(119897)

119895119909119895+1+119862

(119897)

119895+1119895+2+119886

(119897)

119895 According to119860

(119897)le 119906119860(ℎ)

and Remark 7 we obtain10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816le 119906 (1 + 1205741) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (39)

Then let 120596119895 = 119906(1 + 1205741) and from Lemma 10 taking intoaccount that (119899+1)119906(1+1205745119899+1) le (5119899+1)119906(1+1205745119899+1) = 1205745119899+1we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (40)

1205745119899+1 is 119874(119906) so this coefficient perturbation may influ-ence the accuracy we need to consider it in our compensatedalgorithm

Similarly we let 119892(119898)

119895= 119860(119898)

119895119909119895+1 + 119862

(119898)

119895+1119895+2 + 119886

(119898)

119895 then

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119898)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1199061205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (41)

1199061205745119899+1 is 119874(1199062) so this coefficient perturbation does not

influence the accuracy

Remark 11 When 119895 = 119899 the 119899th step of Algorithm 5 is119899 = 119886

(ℎ)

119899 so that we only need to consider the perturbation

of coefficient 119886119899

Next we deduce the round-off error bound Let 119904119895 = 120572119895 +

120573119895 + 120578119895 + 120585119895 According to Theorems 2 and 3 and Remark 7we obtain

10038161003816100381610038161003816120572119895

10038161003816100381610038161003816le (2119906 + 14119906

2)

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1

10038161003816100381610038161003816

le (2119906 + 141199062) (1 + 1205741)

10038161003816100381610038161003816119860119895119909119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119862(ℎ)

119895+1119895+2

10038161003816100381610038161003816le 119906 (1 + 1205741)

10038161003816100381610038161003816119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨3⟩ + 119862

(ℎ)

119895+1119895+2 ⟨2⟩

10038161003816100381610038161003816

le 119906 (1 + 1205743)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨4⟩ + 119862

(ℎ)

119895+1119895+2 ⟨3⟩ + 119886119895 ⟨1⟩

10038161003816100381610038161003816

le 119906 (1 + 1205744)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2 + 119886119895

10038161003816100381610038161003816

(42)

then10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816

le (4119906 + 141199062)

10038161003816100381610038161 + 12057441003816100381610038161003816

times (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(43)

Journal of Applied Mathematics 7

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887ℎ)

119905119897 = (119886ℎ otimes 119887119897) oplus (119886119897 otimes 119887ℎ) oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 12 Multiplication of a double-double number by adouble-double number

function [119903ℎ 119903119897] = 119889119894V 119889 119889(119886 119887)

119902ℎ = 119886 ⊘ 119887

[119905ℎ1 1199051198971] = 119879119908119900119875119903119900119889(119902ℎ 119887)

[119905ℎ2 1199051198972] = 119879119908119900119878119906119898(119886 minus119905ℎ1)

119902119897 = (119905ℎ2 oplus 1199051198972 ⊖ 1199051198971) ⊘ 119887

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119902ℎ 119902119897)

Algorithm 13 Division of a double number by a double number

Let 120596119895 = (4119906 + 141199062)|1 + 1205744| and using it into Lemma 10

from (4+14119906)119899119906(1+1205745119899minus1) le (5119899minus1)119906(1+1205745119899minus1) = 1205745119899minus1 (119899 ge

2) we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(44)

1205745119899minus1 is 119874(119906) so this round-off error may influence theaccuracy we also need to consider it in our compensatedalgorithm

From Theorem 3 we have known that round-off error|120591119895| le 12057421205746|119860

(ℎ)

119895119909119895+1| le 12057421205746(1 + 1205741)|119860119895119909119895+1| According to

Lemma 10 we let 120596119895 = 12057421205746(1 + 1205741) from 1205742 le 2119906(1 + 1205741) and2119899119906(1 + 1205745119899minus3) le 1205745119899minus3 we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

10038161003816100381610038161003816100381610038161003816100381610038161003816

12059111989510038161003816100381610038161003816119901119895 (119909)

10038161003816100381610038161003816le 12057461205745119899minus3

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (45)

12057461205745119899minus3 is119874(1199062) so this round-off error does not influence

the accuracyObserving the error bounds we described above the

perturbation generated by the third part of coefficients in(18) does not influence the accuracy Thanks to the 119889119894V 119889 119889

algorithm in Appendix B (see Algorithm 13) we only need tosplit the coefficients into two floating point numbers

Applying EFT the 119879ℎ119903119890119890119875119903119900119889 algorithm and the 119889119894V 119889 119889

algorithm considering all errors which may influence thenumerical result in working precision in Algorithm 5 weobtain the compensated Clenshaw algorithm in Algorithm 6

Here we give the error bound of Algorithm 6

Theorem 12 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 (119899 ge 2) and119909 a floating point valueThe forward errorbound of the compensated Clenshaw algorithm is

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

le 1199061003816100381610038161003816119901 (119909)

1003816100381610038161003816 + 21205742

5119899minus2

119899

sum

119895=0

119886119895119875119895 (119909) (46)

Proof From Algorithm 6 we obtain

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(0 oplus 1205980) minus 119901 (119909)

10038161003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (0 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

(47)

where |120598| le 119906According toTheorem 8 we have 119901(119909) = 119900 + 120598119887119900 then

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (119875 (119909) minus 120598119887119900 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

le 119906 |119875 (119909)| + (1 + 119906)10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816

(48)

Next we analyze the bound of |120598119887119900 minus 1205980|Let 119892(119897)

119895= 119860(119897)

119895119909119895+1 + 119862

(119897)

119895+1119895+2 + 119886

(119897)

119895 then

119892(119897)

119895= 119860(119897)

119895119909119895+1 ⟨4⟩ + 119862

(119897)

119895+1119895+2 ⟨3⟩ + 119886

(119897)

119895⟨1⟩ (49)

Thus we obtain

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205744

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(50)

According to Lemma 9 we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745119899minus1 (1 + 1205744)

times

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816a(119897)119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(51)

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 3: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Journal of Applied Mathematics 3

Theorem3 For 119886 119887 119888 isin F and 119909 119910 120591 isin F 119879ℎ119903119890119890119875119903119900119889 verifies

[119909 119910] = 119879ℎ119903119890119890119875119903119900119889 (119886 119887 119888) 119909 + 119910 = 119886119887119888 minus 120591

|120591| le 12057421205746 |119886119887119888| 1003816100381610038161003816119910

1003816100381610038161003816 le 2119906 |119886119887119888| + 141199062

|119886119887119888|

(7)

Proof According to Lemma 32 in [20] we have

|120591| le 12057421205746 |119886119887119888| (8)

In Algorithm 4 119910 + 120591 = 119888ℎ + 119890 then

10038161003816100381610038161199101003816100381610038161003816 =

1003816100381610038161003816119910 + 120591 minus 1205911003816100381610038161003816 le |119888ℎ + 119890| + |120591|

le 2119906 |119886119887119888| + 1199062

|119886119887119888| + 12057421205746 |119886119887119888|

le 2119906 |119886119887119888| + 141199062

|119886119887119888|

(9)

23 The Clenshaw Algorithm and Condition Number Thestandard general algorithm for the evaluation of polynomialin Legendre basis 119901(119909) = sum

119899

119895=0119886119895119901119895(119909) is the Clenshaw

algorithm [5] We recall it in Algorithm 5Barrio et al [21] proposed a general polynomial condi-

tion number for any polynomial basis defined by a linearrecurrence and used this new condition number to give theerror bounds for the Clenshaw algorithm Based on thisgeneral condition number we propose the absolute Legendrepolynomial which is similar to the absolute polynomialmentioned in [7 21]

Definition 4 Let 119901119896(119909) be Legendre polynomial We definethe absolute Legendre polynomial 119901119896(119909) which is associatedwith 119901119896(119909) and satisfies

1199010 (119909) = 1

1199011 (119909) = 119909

119901119896 (119909) =2119896 minus 1

119896119909119901119896minus1 (119909) +

119896

119896 + 1119901119896minus2 (119909) (119896 ge 2)

(10)

where |119901119896(119909)| le 119901119896(119909) forall119909 ge 0

The absolute Legendre polynomial satisfies the followingproperty

Lemma 5 Let 119901119896(119909) be the absolute Legendre polynomialThen we have

119901119896 (119909) 119901119895 (119909) le 119901119896+119895 (119909) (11)

Proof Let119860119896 = (2119896+1)(119896+1) and 119896 ge 2 FromDefinition 4we have

119901119896 (119909) = 119860119896minus1119909119901119896minus1 (119909) +119896

119896 + 1119901119896minus2 (119909)

= (

119896minus1

prod

119894=0

119860 119894) 119909119896

+ sdot sdot sdot

(12)

function 119901(119909) = 119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

119887119895 =2119895 + 1

119895 + 1119909119887119895+1 minus

119895 + 1

119895 + 2119887119895+2 + 119886119895

end119901(119909) = 1198870

Algorithm 5 The Clenshaw algorithm for finite Legendre series

then

119901119896 (119909) 119901119895 (119909) = (

119896minus1

prod

119894=0

119860 119894) (

119895minus1

prod

119894=0

119860 119894) 119909119896+119895

+ sdot sdot sdot (13)

Thus the equivalent form of (11) is

(

119896minus1

prod

119894=0

119860 119894) (

119895minus1

prod

119894=0

119860 119894) le

119896+119895minus1

prod

119894=0

119860 119894 (14)

Since 119860119896 is increasing with 119896 we obtain

119895minus1

prod

119894=0

119860 119894 le

119896+119895minus1

prod

119894=119896

119860 119894 (15)

So we finally obtain 119901119896(119909)119901119895(119909) le 119901119896+119895(119909)

Following Definition 4 we introduce the condition num-ber for the evaluation of polynomials in Legendre basis [21]

Definition 6 Let 119901(119909) = sum119899

119896=0119886119896119901119896(119909) where 119901119896(119909) is

Legendre polynomial Let 119901119896(119909) be the absolute Legendrepolynomial Then the absolute condition number is

condabs (119901 119909) = 119901 (|119909|) =

119899

sum

119896=0

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|) (16)

and the relative condition number is

condrel (119901 119909) =119901 (|119909|)1003816100381610038161003816119901 (119909)

1003816100381610038161003816

=sum119899

119896=0

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

1003816100381610038161003816119901 (119909)1003816100381610038161003816

(17)

3 Compensated Algorithm forEvaluating Polynomials

In this section we exhibit the exact round-off errors gener-ated by the Clenshaw algorithm with EFT We also analyzethe perturbations generated by truncating the fractions inAlgorithm 5Wepropose a compensatedClenshaw algorithmto evaluate finite Legendre series and present its error boundin the following

Firstly in order to analyze the perturbations we split eachcoefficient into three parts as follows

119860 = 119860(ℎ)

+ 119860(119897)

+ 119860(119898)

(18)

4 Journal of Applied Mathematics

where119860(ℎ)

119860(119897)

isin F 119860 119860(119898)

isin R and |119860(119897)

| le 119906|119860(ℎ)

| |119860(119898)

| le

119906|119860(119897)

| Let 119860119896 = (2119896 + 1)(119896 + 1) and 119862119896 = minus(119896(119896 + 1)) Thenwe describe the recurrence relation at 119895th step of Algorithm 5for theoretical computation as

119887119895 = (A(ℎ)119895

+ 119860(119897)

119895+ 119860(119898)

119895) 119909119887119895+1

+ (119862(ℎ)

119895+1+ 119862(119897)

119895+1+ 119862(119898)

119895+1) 119887119895+2

+ (119886(ℎ)

119895+ 119886(119897)

119895+ 119886(119898)

119895)

(19)

For numerical computation associated with (19) it is

119895 = 119860(ℎ)

119895otimes 119909 otimes 119895+1 oplus 119862

(ℎ)

119895+1otimes 119895+2 oplus 119886

(ℎ)

119895 (20)

Remark 7 Let 119860 isin R We split a coefficient 119860 like (18) thenthe representation of splitting is unique and 119860 = 119860

(ℎ)oplus 119860(119897)

119860 = 119860⟨1⟩

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 Since every

elementary floating point operation in Algorithm 5 causesround-off errors in numerical computation we apply 119864119865119879

and the 119879ℎ119903119890119890119875119903119900119889 algorithms to take notes of all round-offerrors and obtain

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889 (119860(ℎ)

119895 119909 119895+1)

[119904 120573119895] = 119879119908119900119875119903119900119889 (119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898 (119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898 (119905 119886(ℎ)

119895)

(21)

The sum of the perturbation and the round-off errors of therecurrence relation at 119895th step is

119908119895 = (119860(119897)

119895+ 119860(119898)

119895) 119909119895+1 + (119862

(119897)

119895+1+ 119862(119898)

119895+1) 119895+2

+ (119886(119897)

119895+ 119886(119898)

119895) + 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895

(22)

where 119903+120572119895+120591119895 = 119860(ℎ)

119895119909119895+1 120591119895 is defined inTheorem 3Then

we obtain the following theorem

Theorem 8 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and let 119909 be a floating point value One assumes that119860119895 = 119860

(ℎ)

119895and119862119895 = 119862

(ℎ)

119895inAlgorithm 5 and 0 is the numerical

result 119908119895 is described in (22) for 119895 = 0 1 119899 minus 1 Then oneobtains

119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (23)

Proof The perturbation of Algorithm 5 is

(119860(119897)

119895+ 119860(119898)

j ) 119909119895+1 + (119862(119897)

119895+1+ 119862(119898)

119895+1) 119895+2 + (119886

(119897)

119895+ 119886(119898)

119895)

(24)

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 FromTheorems

2ndash3 and (21) we can easily obtain

119860(ℎ)

119895119895+1119909 = 119903 + 120572119895 + 120591119895

119862(ℎ)

119895+1119895+2 = 119904 + 120573119895

119903 + 119904 = 119905 + 120578119895

119905 + 119886(ℎ)

119895= 119895 + 120585119895

(25)

Let 119904119895 = 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895 for 119895 = 0 1 119899 minus 1 then

119895 + 119904119895 = 119860(ℎ)

119895119895+1119909 + 119862

(ℎ)

119895+1119895+2 + 119886

(ℎ)

119895 119895 = 0 1 119899 minus 1

(26)

From (18) (19) (22) and (24) we have

119895 + 119908119895 = 119860119895119895+1119909 + 119862119895+1119895+2 + 119886119895 119895 = 0 1 119899 minus 1

(27)

Thus

0 =

119899

sum

119895=0

(119886119895 minus 119908119895) 119901119895 (119909) (28)

then119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (29)

To devise a compensated algorithm of Algorithm 5 andgive its error bound we need the following lemmas

Lemma 9 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 119909 a floating point value and 0 the numerical resultof Algorithm 5 Then

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816 le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (30)

Proof Applying the standard model of floating point arith-metic from Algorithm 5 and Remark 7 we have

119899minus1 = 119860119899minus1119899119909 ⟨4⟩ + 119886119899minus1 ⟨1⟩

119899minus2 = 119860119899minus2119899minus1119909 ⟨5⟩ + 119862119899minus1119899 ⟨4⟩ + 119886119899minus2 ⟨1⟩

0 = 11986001119909 ⟨5⟩ + 11986212 ⟨4⟩ + 1198860 ⟨1⟩

(31)

Thus we obtain

0 = ⟨4 + 5 (119899 minus 1)⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

= ⟨5119899 minus 1⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

(32)

Journal of Applied Mathematics 5

function 119903119890119904 = 119862119900119898119901119862119897119890119899119904ℎ119886119908(119901 119909)

119899+2 = 119899+1 = 0

120598119899+2 = 120598119899+1 = 0

for 119895 = 119899 minus1 0

[119860(ℎ)

119895 119860(119897)

119895] = 119889119894V 119889 119889(2119895 + 1 119895 + 1)

[119862(ℎ)

119895 119862(119897)

119895] = 119889119894V 119889 119889(minus119895 minus 1 119895 + 2)

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889(119860(ℎ)

119895 119895+1 119909)

[119904 120573119895] = 119879119908119900119875119903119900119889(119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898(119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898(119905 119886

119895)

119904119895 = 120572119895 oplus 120573119895 oplus 120578119895 oplus 120585119895 oplus (119860(119897)

119895otimes 119909 otimes 119895+1 oplus 119862

(119897)

119895+1otimes 119895+2 oplus 119886

(119897)

119895)

120598119895 = 119860(ℎ)

119895otimes 119909 otimes 120598119895+1 oplus 119862

(ℎ)

119895+1otimes 120598119895+2 oplus 119904119895

end119903119890119904 = 119910 oplus 1205980

Algorithm 6 Compensated Clenshaw algorithm

function 119887 = 119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887(119899)

0= 119886119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

119887(119895)

0= 119886119895 minus

1198621

1198601119887(119895+1)

1(119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1minus

119862119896+1

119860119896+1119887(119895+1)

119896+1(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1(119896 ge 119899 minus 119895 minus 1)

endend119887 = 119887(0)

Algorithm 7 The conversion algorithm from power basis to Legendre basis

Then from Definition 1 we get

100381610038161003816100381610038160 minus 119901 (119909)

10038161003816100381610038161003816=

1003816100381610038161003816100381610038161003816100381610038161003816

(

119899minus1

prod

119894=0

119860 119894) 1199091198991198861198991205795119899minus1 + sdot sdot sdot + 11988601205791

1003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1((

119899minus1

prod

119894=0

119860 119894) |119909|119899 1003816100381610038161003816119886119899

1003816100381610038161003816 + sdot sdot sdot +10038161003816100381610038161198860

1003816100381610038161003816)

= 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119895 (|119909|)

(33)

Lemma 10 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value We assume that 120590119895 le

120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) where 120596119895 is real numbersthen

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (34)

Proof According to (31) we get

10038161003816100381610038161003816119895

10038161003816100381610038161003816le (1 + 1205745) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (35)

Since 120590119895 le 120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) fromDefinition 1 we have

120590119895 le 120596119895 (1 + 1205745(119899minus119895minus1)) Σ119899

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|) (36)

6 Journal of Applied Mathematics

function [119909 119910] = 119865119886119904119905119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119910 = (119886 ⊖ 119909) oplus 119887

Algorithm 8 EFT of the sum of two floating point numbers (|119886| ge

|119887|)

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886ℎ 119887)

119905119897 = 119886119897 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 9 Addition of a double-double number and a doublenumber

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119904ℎ 119904119897] = 119879119908119900119878119906119898(119886ℎ 119887ℎ)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886119897 119887119897)

119904119897 = 119904119897 oplus 119905ℎ

119905ℎ = 119904ℎ oplus 119904119897

119904119897 = 119904119897 ⊖ (119905ℎ ⊖ 119904ℎ)

119905119897 = 119905119897 oplus 119904119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 10 Addition of a double-double number and a double-double number

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887)

119905119897 = 119886119897 otimes 119887 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 11 Multiplication of a double-double number by adouble number

then119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

times

119899minus1

sum

119895=0

(

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|)) 119901119895 (|119909|)

(37)

According to Lemma 5 we obtain

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

119899minus1

sum

119895=0

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(38)

Among the perturbed and round-off errors inAlgorithm 5 we deem that some errors do not influence thenumerical result in working precision Now we can give theperturbed error bounds and the round-off error boundsrespectively At first we analyze the perturbed error in (24)Let 119892(119897)

119895= 119860(119897)

119895119909119895+1+119862

(119897)

119895+1119895+2+119886

(119897)

119895 According to119860

(119897)le 119906119860(ℎ)

and Remark 7 we obtain10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816le 119906 (1 + 1205741) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (39)

Then let 120596119895 = 119906(1 + 1205741) and from Lemma 10 taking intoaccount that (119899+1)119906(1+1205745119899+1) le (5119899+1)119906(1+1205745119899+1) = 1205745119899+1we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (40)

1205745119899+1 is 119874(119906) so this coefficient perturbation may influ-ence the accuracy we need to consider it in our compensatedalgorithm

Similarly we let 119892(119898)

119895= 119860(119898)

119895119909119895+1 + 119862

(119898)

119895+1119895+2 + 119886

(119898)

119895 then

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119898)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1199061205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (41)

1199061205745119899+1 is 119874(1199062) so this coefficient perturbation does not

influence the accuracy

Remark 11 When 119895 = 119899 the 119899th step of Algorithm 5 is119899 = 119886

(ℎ)

119899 so that we only need to consider the perturbation

of coefficient 119886119899

Next we deduce the round-off error bound Let 119904119895 = 120572119895 +

120573119895 + 120578119895 + 120585119895 According to Theorems 2 and 3 and Remark 7we obtain

10038161003816100381610038161003816120572119895

10038161003816100381610038161003816le (2119906 + 14119906

2)

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1

10038161003816100381610038161003816

le (2119906 + 141199062) (1 + 1205741)

10038161003816100381610038161003816119860119895119909119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119862(ℎ)

119895+1119895+2

10038161003816100381610038161003816le 119906 (1 + 1205741)

10038161003816100381610038161003816119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨3⟩ + 119862

(ℎ)

119895+1119895+2 ⟨2⟩

10038161003816100381610038161003816

le 119906 (1 + 1205743)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨4⟩ + 119862

(ℎ)

119895+1119895+2 ⟨3⟩ + 119886119895 ⟨1⟩

10038161003816100381610038161003816

le 119906 (1 + 1205744)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2 + 119886119895

10038161003816100381610038161003816

(42)

then10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816

le (4119906 + 141199062)

10038161003816100381610038161 + 12057441003816100381610038161003816

times (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(43)

Journal of Applied Mathematics 7

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887ℎ)

119905119897 = (119886ℎ otimes 119887119897) oplus (119886119897 otimes 119887ℎ) oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 12 Multiplication of a double-double number by adouble-double number

function [119903ℎ 119903119897] = 119889119894V 119889 119889(119886 119887)

119902ℎ = 119886 ⊘ 119887

[119905ℎ1 1199051198971] = 119879119908119900119875119903119900119889(119902ℎ 119887)

[119905ℎ2 1199051198972] = 119879119908119900119878119906119898(119886 minus119905ℎ1)

119902119897 = (119905ℎ2 oplus 1199051198972 ⊖ 1199051198971) ⊘ 119887

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119902ℎ 119902119897)

Algorithm 13 Division of a double number by a double number

Let 120596119895 = (4119906 + 141199062)|1 + 1205744| and using it into Lemma 10

from (4+14119906)119899119906(1+1205745119899minus1) le (5119899minus1)119906(1+1205745119899minus1) = 1205745119899minus1 (119899 ge

2) we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(44)

1205745119899minus1 is 119874(119906) so this round-off error may influence theaccuracy we also need to consider it in our compensatedalgorithm

From Theorem 3 we have known that round-off error|120591119895| le 12057421205746|119860

(ℎ)

119895119909119895+1| le 12057421205746(1 + 1205741)|119860119895119909119895+1| According to

Lemma 10 we let 120596119895 = 12057421205746(1 + 1205741) from 1205742 le 2119906(1 + 1205741) and2119899119906(1 + 1205745119899minus3) le 1205745119899minus3 we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

10038161003816100381610038161003816100381610038161003816100381610038161003816

12059111989510038161003816100381610038161003816119901119895 (119909)

10038161003816100381610038161003816le 12057461205745119899minus3

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (45)

12057461205745119899minus3 is119874(1199062) so this round-off error does not influence

the accuracyObserving the error bounds we described above the

perturbation generated by the third part of coefficients in(18) does not influence the accuracy Thanks to the 119889119894V 119889 119889

algorithm in Appendix B (see Algorithm 13) we only need tosplit the coefficients into two floating point numbers

Applying EFT the 119879ℎ119903119890119890119875119903119900119889 algorithm and the 119889119894V 119889 119889

algorithm considering all errors which may influence thenumerical result in working precision in Algorithm 5 weobtain the compensated Clenshaw algorithm in Algorithm 6

Here we give the error bound of Algorithm 6

Theorem 12 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 (119899 ge 2) and119909 a floating point valueThe forward errorbound of the compensated Clenshaw algorithm is

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

le 1199061003816100381610038161003816119901 (119909)

1003816100381610038161003816 + 21205742

5119899minus2

119899

sum

119895=0

119886119895119875119895 (119909) (46)

Proof From Algorithm 6 we obtain

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(0 oplus 1205980) minus 119901 (119909)

10038161003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (0 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

(47)

where |120598| le 119906According toTheorem 8 we have 119901(119909) = 119900 + 120598119887119900 then

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (119875 (119909) minus 120598119887119900 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

le 119906 |119875 (119909)| + (1 + 119906)10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816

(48)

Next we analyze the bound of |120598119887119900 minus 1205980|Let 119892(119897)

119895= 119860(119897)

119895119909119895+1 + 119862

(119897)

119895+1119895+2 + 119886

(119897)

119895 then

119892(119897)

119895= 119860(119897)

119895119909119895+1 ⟨4⟩ + 119862

(119897)

119895+1119895+2 ⟨3⟩ + 119886

(119897)

119895⟨1⟩ (49)

Thus we obtain

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205744

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(50)

According to Lemma 9 we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745119899minus1 (1 + 1205744)

times

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816a(119897)119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(51)

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 4: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

4 Journal of Applied Mathematics

where119860(ℎ)

119860(119897)

isin F 119860 119860(119898)

isin R and |119860(119897)

| le 119906|119860(ℎ)

| |119860(119898)

| le

119906|119860(119897)

| Let 119860119896 = (2119896 + 1)(119896 + 1) and 119862119896 = minus(119896(119896 + 1)) Thenwe describe the recurrence relation at 119895th step of Algorithm 5for theoretical computation as

119887119895 = (A(ℎ)119895

+ 119860(119897)

119895+ 119860(119898)

119895) 119909119887119895+1

+ (119862(ℎ)

119895+1+ 119862(119897)

119895+1+ 119862(119898)

119895+1) 119887119895+2

+ (119886(ℎ)

119895+ 119886(119897)

119895+ 119886(119898)

119895)

(19)

For numerical computation associated with (19) it is

119895 = 119860(ℎ)

119895otimes 119909 otimes 119895+1 oplus 119862

(ℎ)

119895+1otimes 119895+2 oplus 119886

(ℎ)

119895 (20)

Remark 7 Let 119860 isin R We split a coefficient 119860 like (18) thenthe representation of splitting is unique and 119860 = 119860

(ℎ)oplus 119860(119897)

119860 = 119860⟨1⟩

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 Since every

elementary floating point operation in Algorithm 5 causesround-off errors in numerical computation we apply 119864119865119879

and the 119879ℎ119903119890119890119875119903119900119889 algorithms to take notes of all round-offerrors and obtain

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889 (119860(ℎ)

119895 119909 119895+1)

[119904 120573119895] = 119879119908119900119875119903119900119889 (119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898 (119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898 (119905 119886(ℎ)

119895)

(21)

The sum of the perturbation and the round-off errors of therecurrence relation at 119895th step is

119908119895 = (119860(119897)

119895+ 119860(119898)

119895) 119909119895+1 + (119862

(119897)

119895+1+ 119862(119898)

119895+1) 119895+2

+ (119886(119897)

119895+ 119886(119898)

119895) + 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895

(22)

where 119903+120572119895+120591119895 = 119860(ℎ)

119895119909119895+1 120591119895 is defined inTheorem 3Then

we obtain the following theorem

Theorem 8 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and let 119909 be a floating point value One assumes that119860119895 = 119860

(ℎ)

119895and119862119895 = 119862

(ℎ)

119895inAlgorithm 5 and 0 is the numerical

result 119908119895 is described in (22) for 119895 = 0 1 119899 minus 1 Then oneobtains

119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (23)

Proof The perturbation of Algorithm 5 is

(119860(119897)

119895+ 119860(119898)

j ) 119909119895+1 + (119862(119897)

119895+1+ 119862(119898)

119895+1) 119895+2 + (119886

(119897)

119895+ 119886(119898)

119895)

(24)

Let 119860119895 = 119860(ℎ)

119895and 119862119895 = 119862

(ℎ)

119895in Algorithm 5 FromTheorems

2ndash3 and (21) we can easily obtain

119860(ℎ)

119895119895+1119909 = 119903 + 120572119895 + 120591119895

119862(ℎ)

119895+1119895+2 = 119904 + 120573119895

119903 + 119904 = 119905 + 120578119895

119905 + 119886(ℎ)

119895= 119895 + 120585119895

(25)

Let 119904119895 = 120572119895 + 120591119895 + 120573119895 + 120578119895 + 120585119895 for 119895 = 0 1 119899 minus 1 then

119895 + 119904119895 = 119860(ℎ)

119895119895+1119909 + 119862

(ℎ)

119895+1119895+2 + 119886

(ℎ)

119895 119895 = 0 1 119899 minus 1

(26)

From (18) (19) (22) and (24) we have

119895 + 119908119895 = 119860119895119895+1119909 + 119862119895+1119895+2 + 119886119895 119895 = 0 1 119899 minus 1

(27)

Thus

0 =

119899

sum

119895=0

(119886119895 minus 119908119895) 119901119895 (119909) (28)

then119899minus1

sum

119895=0

119908119895119901119895 (119909) + 0 =

119899

sum

119895=0

119886119895119901119895 (119909) (29)

To devise a compensated algorithm of Algorithm 5 andgive its error bound we need the following lemmas

Lemma 9 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 119909 a floating point value and 0 the numerical resultof Algorithm 5 Then

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816 le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (30)

Proof Applying the standard model of floating point arith-metic from Algorithm 5 and Remark 7 we have

119899minus1 = 119860119899minus1119899119909 ⟨4⟩ + 119886119899minus1 ⟨1⟩

119899minus2 = 119860119899minus2119899minus1119909 ⟨5⟩ + 119862119899minus1119899 ⟨4⟩ + 119886119899minus2 ⟨1⟩

0 = 11986001119909 ⟨5⟩ + 11986212 ⟨4⟩ + 1198860 ⟨1⟩

(31)

Thus we obtain

0 = ⟨4 + 5 (119899 minus 1)⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

= ⟨5119899 minus 1⟩ (

119899minus1

prod

119894=0

119860 119894) 119909119899119886119899 + sdot sdot sdot + 1198860 ⟨1⟩

(32)

Journal of Applied Mathematics 5

function 119903119890119904 = 119862119900119898119901119862119897119890119899119904ℎ119886119908(119901 119909)

119899+2 = 119899+1 = 0

120598119899+2 = 120598119899+1 = 0

for 119895 = 119899 minus1 0

[119860(ℎ)

119895 119860(119897)

119895] = 119889119894V 119889 119889(2119895 + 1 119895 + 1)

[119862(ℎ)

119895 119862(119897)

119895] = 119889119894V 119889 119889(minus119895 minus 1 119895 + 2)

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889(119860(ℎ)

119895 119895+1 119909)

[119904 120573119895] = 119879119908119900119875119903119900119889(119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898(119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898(119905 119886

119895)

119904119895 = 120572119895 oplus 120573119895 oplus 120578119895 oplus 120585119895 oplus (119860(119897)

119895otimes 119909 otimes 119895+1 oplus 119862

(119897)

119895+1otimes 119895+2 oplus 119886

(119897)

119895)

120598119895 = 119860(ℎ)

119895otimes 119909 otimes 120598119895+1 oplus 119862

(ℎ)

119895+1otimes 120598119895+2 oplus 119904119895

end119903119890119904 = 119910 oplus 1205980

Algorithm 6 Compensated Clenshaw algorithm

function 119887 = 119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887(119899)

0= 119886119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

119887(119895)

0= 119886119895 minus

1198621

1198601119887(119895+1)

1(119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1minus

119862119896+1

119860119896+1119887(119895+1)

119896+1(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1(119896 ge 119899 minus 119895 minus 1)

endend119887 = 119887(0)

Algorithm 7 The conversion algorithm from power basis to Legendre basis

Then from Definition 1 we get

100381610038161003816100381610038160 minus 119901 (119909)

10038161003816100381610038161003816=

1003816100381610038161003816100381610038161003816100381610038161003816

(

119899minus1

prod

119894=0

119860 119894) 1199091198991198861198991205795119899minus1 + sdot sdot sdot + 11988601205791

1003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1((

119899minus1

prod

119894=0

119860 119894) |119909|119899 1003816100381610038161003816119886119899

1003816100381610038161003816 + sdot sdot sdot +10038161003816100381610038161198860

1003816100381610038161003816)

= 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119895 (|119909|)

(33)

Lemma 10 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value We assume that 120590119895 le

120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) where 120596119895 is real numbersthen

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (34)

Proof According to (31) we get

10038161003816100381610038161003816119895

10038161003816100381610038161003816le (1 + 1205745) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (35)

Since 120590119895 le 120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) fromDefinition 1 we have

120590119895 le 120596119895 (1 + 1205745(119899minus119895minus1)) Σ119899

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|) (36)

6 Journal of Applied Mathematics

function [119909 119910] = 119865119886119904119905119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119910 = (119886 ⊖ 119909) oplus 119887

Algorithm 8 EFT of the sum of two floating point numbers (|119886| ge

|119887|)

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886ℎ 119887)

119905119897 = 119886119897 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 9 Addition of a double-double number and a doublenumber

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119904ℎ 119904119897] = 119879119908119900119878119906119898(119886ℎ 119887ℎ)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886119897 119887119897)

119904119897 = 119904119897 oplus 119905ℎ

119905ℎ = 119904ℎ oplus 119904119897

119904119897 = 119904119897 ⊖ (119905ℎ ⊖ 119904ℎ)

119905119897 = 119905119897 oplus 119904119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 10 Addition of a double-double number and a double-double number

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887)

119905119897 = 119886119897 otimes 119887 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 11 Multiplication of a double-double number by adouble number

then119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

times

119899minus1

sum

119895=0

(

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|)) 119901119895 (|119909|)

(37)

According to Lemma 5 we obtain

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

119899minus1

sum

119895=0

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(38)

Among the perturbed and round-off errors inAlgorithm 5 we deem that some errors do not influence thenumerical result in working precision Now we can give theperturbed error bounds and the round-off error boundsrespectively At first we analyze the perturbed error in (24)Let 119892(119897)

119895= 119860(119897)

119895119909119895+1+119862

(119897)

119895+1119895+2+119886

(119897)

119895 According to119860

(119897)le 119906119860(ℎ)

and Remark 7 we obtain10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816le 119906 (1 + 1205741) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (39)

Then let 120596119895 = 119906(1 + 1205741) and from Lemma 10 taking intoaccount that (119899+1)119906(1+1205745119899+1) le (5119899+1)119906(1+1205745119899+1) = 1205745119899+1we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (40)

1205745119899+1 is 119874(119906) so this coefficient perturbation may influ-ence the accuracy we need to consider it in our compensatedalgorithm

Similarly we let 119892(119898)

119895= 119860(119898)

119895119909119895+1 + 119862

(119898)

119895+1119895+2 + 119886

(119898)

119895 then

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119898)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1199061205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (41)

1199061205745119899+1 is 119874(1199062) so this coefficient perturbation does not

influence the accuracy

Remark 11 When 119895 = 119899 the 119899th step of Algorithm 5 is119899 = 119886

(ℎ)

119899 so that we only need to consider the perturbation

of coefficient 119886119899

Next we deduce the round-off error bound Let 119904119895 = 120572119895 +

120573119895 + 120578119895 + 120585119895 According to Theorems 2 and 3 and Remark 7we obtain

10038161003816100381610038161003816120572119895

10038161003816100381610038161003816le (2119906 + 14119906

2)

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1

10038161003816100381610038161003816

le (2119906 + 141199062) (1 + 1205741)

10038161003816100381610038161003816119860119895119909119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119862(ℎ)

119895+1119895+2

10038161003816100381610038161003816le 119906 (1 + 1205741)

10038161003816100381610038161003816119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨3⟩ + 119862

(ℎ)

119895+1119895+2 ⟨2⟩

10038161003816100381610038161003816

le 119906 (1 + 1205743)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨4⟩ + 119862

(ℎ)

119895+1119895+2 ⟨3⟩ + 119886119895 ⟨1⟩

10038161003816100381610038161003816

le 119906 (1 + 1205744)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2 + 119886119895

10038161003816100381610038161003816

(42)

then10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816

le (4119906 + 141199062)

10038161003816100381610038161 + 12057441003816100381610038161003816

times (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(43)

Journal of Applied Mathematics 7

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887ℎ)

119905119897 = (119886ℎ otimes 119887119897) oplus (119886119897 otimes 119887ℎ) oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 12 Multiplication of a double-double number by adouble-double number

function [119903ℎ 119903119897] = 119889119894V 119889 119889(119886 119887)

119902ℎ = 119886 ⊘ 119887

[119905ℎ1 1199051198971] = 119879119908119900119875119903119900119889(119902ℎ 119887)

[119905ℎ2 1199051198972] = 119879119908119900119878119906119898(119886 minus119905ℎ1)

119902119897 = (119905ℎ2 oplus 1199051198972 ⊖ 1199051198971) ⊘ 119887

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119902ℎ 119902119897)

Algorithm 13 Division of a double number by a double number

Let 120596119895 = (4119906 + 141199062)|1 + 1205744| and using it into Lemma 10

from (4+14119906)119899119906(1+1205745119899minus1) le (5119899minus1)119906(1+1205745119899minus1) = 1205745119899minus1 (119899 ge

2) we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(44)

1205745119899minus1 is 119874(119906) so this round-off error may influence theaccuracy we also need to consider it in our compensatedalgorithm

From Theorem 3 we have known that round-off error|120591119895| le 12057421205746|119860

(ℎ)

119895119909119895+1| le 12057421205746(1 + 1205741)|119860119895119909119895+1| According to

Lemma 10 we let 120596119895 = 12057421205746(1 + 1205741) from 1205742 le 2119906(1 + 1205741) and2119899119906(1 + 1205745119899minus3) le 1205745119899minus3 we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

10038161003816100381610038161003816100381610038161003816100381610038161003816

12059111989510038161003816100381610038161003816119901119895 (119909)

10038161003816100381610038161003816le 12057461205745119899minus3

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (45)

12057461205745119899minus3 is119874(1199062) so this round-off error does not influence

the accuracyObserving the error bounds we described above the

perturbation generated by the third part of coefficients in(18) does not influence the accuracy Thanks to the 119889119894V 119889 119889

algorithm in Appendix B (see Algorithm 13) we only need tosplit the coefficients into two floating point numbers

Applying EFT the 119879ℎ119903119890119890119875119903119900119889 algorithm and the 119889119894V 119889 119889

algorithm considering all errors which may influence thenumerical result in working precision in Algorithm 5 weobtain the compensated Clenshaw algorithm in Algorithm 6

Here we give the error bound of Algorithm 6

Theorem 12 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 (119899 ge 2) and119909 a floating point valueThe forward errorbound of the compensated Clenshaw algorithm is

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

le 1199061003816100381610038161003816119901 (119909)

1003816100381610038161003816 + 21205742

5119899minus2

119899

sum

119895=0

119886119895119875119895 (119909) (46)

Proof From Algorithm 6 we obtain

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(0 oplus 1205980) minus 119901 (119909)

10038161003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (0 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

(47)

where |120598| le 119906According toTheorem 8 we have 119901(119909) = 119900 + 120598119887119900 then

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (119875 (119909) minus 120598119887119900 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

le 119906 |119875 (119909)| + (1 + 119906)10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816

(48)

Next we analyze the bound of |120598119887119900 minus 1205980|Let 119892(119897)

119895= 119860(119897)

119895119909119895+1 + 119862

(119897)

119895+1119895+2 + 119886

(119897)

119895 then

119892(119897)

119895= 119860(119897)

119895119909119895+1 ⟨4⟩ + 119862

(119897)

119895+1119895+2 ⟨3⟩ + 119886

(119897)

119895⟨1⟩ (49)

Thus we obtain

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205744

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(50)

According to Lemma 9 we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745119899minus1 (1 + 1205744)

times

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816a(119897)119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(51)

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 5: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Journal of Applied Mathematics 5

function 119903119890119904 = 119862119900119898119901119862119897119890119899119904ℎ119886119908(119901 119909)

119899+2 = 119899+1 = 0

120598119899+2 = 120598119899+1 = 0

for 119895 = 119899 minus1 0

[119860(ℎ)

119895 119860(119897)

119895] = 119889119894V 119889 119889(2119895 + 1 119895 + 1)

[119862(ℎ)

119895 119862(119897)

119895] = 119889119894V 119889 119889(minus119895 minus 1 119895 + 2)

[119903 120572119895] = 119879ℎ119903119890119890119875119903119900119889(119860(ℎ)

119895 119895+1 119909)

[119904 120573119895] = 119879119908119900119875119903119900119889(119862(ℎ)

119895+1 119895+2)

[119905 120578119895] = 119879119908119900119878119906119898(119903 119904)

[119895 120585119895] = 119879119908119900119878119906119898(119905 119886

119895)

119904119895 = 120572119895 oplus 120573119895 oplus 120578119895 oplus 120585119895 oplus (119860(119897)

119895otimes 119909 otimes 119895+1 oplus 119862

(119897)

119895+1otimes 119895+2 oplus 119886

(119897)

119895)

120598119895 = 119860(ℎ)

119895otimes 119909 otimes 120598119895+1 oplus 119862

(ℎ)

119895+1otimes 120598119895+2 oplus 119904119895

end119903119890119904 = 119910 oplus 1205980

Algorithm 6 Compensated Clenshaw algorithm

function 119887 = 119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887(119899)

0= 119886119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

119887(119895)

0= 119886119895 minus

1198621

1198601119887(119895+1)

1(119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1minus

119862119896+1

119860119896+1119887(119895+1)

119896+1(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1(119896 ge 119899 minus 119895 minus 1)

endend119887 = 119887(0)

Algorithm 7 The conversion algorithm from power basis to Legendre basis

Then from Definition 1 we get

100381610038161003816100381610038160 minus 119901 (119909)

10038161003816100381610038161003816=

1003816100381610038161003816100381610038161003816100381610038161003816

(

119899minus1

prod

119894=0

119860 119894) 1199091198991198861198991205795119899minus1 + sdot sdot sdot + 11988601205791

1003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1((

119899minus1

prod

119894=0

119860 119894) |119909|119899 1003816100381610038161003816119886119899

1003816100381610038161003816 + sdot sdot sdot +10038161003816100381610038161198860

1003816100381610038161003816)

= 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119895 (|119909|)

(33)

Lemma 10 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value We assume that 120590119895 le

120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) where 120596119895 is real numbersthen

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (34)

Proof According to (31) we get

10038161003816100381610038161003816119895

10038161003816100381610038161003816le (1 + 1205745) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (35)

Since 120590119895 le 120596119895(119860119895|119909||119895+1| + |119862119895+1||119895+2| + |119886119895|) fromDefinition 1 we have

120590119895 le 120596119895 (1 + 1205745(119899minus119895minus1)) Σ119899

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|) (36)

6 Journal of Applied Mathematics

function [119909 119910] = 119865119886119904119905119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119910 = (119886 ⊖ 119909) oplus 119887

Algorithm 8 EFT of the sum of two floating point numbers (|119886| ge

|119887|)

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886ℎ 119887)

119905119897 = 119886119897 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 9 Addition of a double-double number and a doublenumber

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119904ℎ 119904119897] = 119879119908119900119878119906119898(119886ℎ 119887ℎ)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886119897 119887119897)

119904119897 = 119904119897 oplus 119905ℎ

119905ℎ = 119904ℎ oplus 119904119897

119904119897 = 119904119897 ⊖ (119905ℎ ⊖ 119904ℎ)

119905119897 = 119905119897 oplus 119904119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 10 Addition of a double-double number and a double-double number

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887)

119905119897 = 119886119897 otimes 119887 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 11 Multiplication of a double-double number by adouble number

then119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

times

119899minus1

sum

119895=0

(

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|)) 119901119895 (|119909|)

(37)

According to Lemma 5 we obtain

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

119899minus1

sum

119895=0

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(38)

Among the perturbed and round-off errors inAlgorithm 5 we deem that some errors do not influence thenumerical result in working precision Now we can give theperturbed error bounds and the round-off error boundsrespectively At first we analyze the perturbed error in (24)Let 119892(119897)

119895= 119860(119897)

119895119909119895+1+119862

(119897)

119895+1119895+2+119886

(119897)

119895 According to119860

(119897)le 119906119860(ℎ)

and Remark 7 we obtain10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816le 119906 (1 + 1205741) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (39)

Then let 120596119895 = 119906(1 + 1205741) and from Lemma 10 taking intoaccount that (119899+1)119906(1+1205745119899+1) le (5119899+1)119906(1+1205745119899+1) = 1205745119899+1we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (40)

1205745119899+1 is 119874(119906) so this coefficient perturbation may influ-ence the accuracy we need to consider it in our compensatedalgorithm

Similarly we let 119892(119898)

119895= 119860(119898)

119895119909119895+1 + 119862

(119898)

119895+1119895+2 + 119886

(119898)

119895 then

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119898)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1199061205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (41)

1199061205745119899+1 is 119874(1199062) so this coefficient perturbation does not

influence the accuracy

Remark 11 When 119895 = 119899 the 119899th step of Algorithm 5 is119899 = 119886

(ℎ)

119899 so that we only need to consider the perturbation

of coefficient 119886119899

Next we deduce the round-off error bound Let 119904119895 = 120572119895 +

120573119895 + 120578119895 + 120585119895 According to Theorems 2 and 3 and Remark 7we obtain

10038161003816100381610038161003816120572119895

10038161003816100381610038161003816le (2119906 + 14119906

2)

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1

10038161003816100381610038161003816

le (2119906 + 141199062) (1 + 1205741)

10038161003816100381610038161003816119860119895119909119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119862(ℎ)

119895+1119895+2

10038161003816100381610038161003816le 119906 (1 + 1205741)

10038161003816100381610038161003816119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨3⟩ + 119862

(ℎ)

119895+1119895+2 ⟨2⟩

10038161003816100381610038161003816

le 119906 (1 + 1205743)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨4⟩ + 119862

(ℎ)

119895+1119895+2 ⟨3⟩ + 119886119895 ⟨1⟩

10038161003816100381610038161003816

le 119906 (1 + 1205744)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2 + 119886119895

10038161003816100381610038161003816

(42)

then10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816

le (4119906 + 141199062)

10038161003816100381610038161 + 12057441003816100381610038161003816

times (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(43)

Journal of Applied Mathematics 7

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887ℎ)

119905119897 = (119886ℎ otimes 119887119897) oplus (119886119897 otimes 119887ℎ) oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 12 Multiplication of a double-double number by adouble-double number

function [119903ℎ 119903119897] = 119889119894V 119889 119889(119886 119887)

119902ℎ = 119886 ⊘ 119887

[119905ℎ1 1199051198971] = 119879119908119900119875119903119900119889(119902ℎ 119887)

[119905ℎ2 1199051198972] = 119879119908119900119878119906119898(119886 minus119905ℎ1)

119902119897 = (119905ℎ2 oplus 1199051198972 ⊖ 1199051198971) ⊘ 119887

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119902ℎ 119902119897)

Algorithm 13 Division of a double number by a double number

Let 120596119895 = (4119906 + 141199062)|1 + 1205744| and using it into Lemma 10

from (4+14119906)119899119906(1+1205745119899minus1) le (5119899minus1)119906(1+1205745119899minus1) = 1205745119899minus1 (119899 ge

2) we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(44)

1205745119899minus1 is 119874(119906) so this round-off error may influence theaccuracy we also need to consider it in our compensatedalgorithm

From Theorem 3 we have known that round-off error|120591119895| le 12057421205746|119860

(ℎ)

119895119909119895+1| le 12057421205746(1 + 1205741)|119860119895119909119895+1| According to

Lemma 10 we let 120596119895 = 12057421205746(1 + 1205741) from 1205742 le 2119906(1 + 1205741) and2119899119906(1 + 1205745119899minus3) le 1205745119899minus3 we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

10038161003816100381610038161003816100381610038161003816100381610038161003816

12059111989510038161003816100381610038161003816119901119895 (119909)

10038161003816100381610038161003816le 12057461205745119899minus3

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (45)

12057461205745119899minus3 is119874(1199062) so this round-off error does not influence

the accuracyObserving the error bounds we described above the

perturbation generated by the third part of coefficients in(18) does not influence the accuracy Thanks to the 119889119894V 119889 119889

algorithm in Appendix B (see Algorithm 13) we only need tosplit the coefficients into two floating point numbers

Applying EFT the 119879ℎ119903119890119890119875119903119900119889 algorithm and the 119889119894V 119889 119889

algorithm considering all errors which may influence thenumerical result in working precision in Algorithm 5 weobtain the compensated Clenshaw algorithm in Algorithm 6

Here we give the error bound of Algorithm 6

Theorem 12 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 (119899 ge 2) and119909 a floating point valueThe forward errorbound of the compensated Clenshaw algorithm is

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

le 1199061003816100381610038161003816119901 (119909)

1003816100381610038161003816 + 21205742

5119899minus2

119899

sum

119895=0

119886119895119875119895 (119909) (46)

Proof From Algorithm 6 we obtain

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(0 oplus 1205980) minus 119901 (119909)

10038161003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (0 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

(47)

where |120598| le 119906According toTheorem 8 we have 119901(119909) = 119900 + 120598119887119900 then

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (119875 (119909) minus 120598119887119900 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

le 119906 |119875 (119909)| + (1 + 119906)10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816

(48)

Next we analyze the bound of |120598119887119900 minus 1205980|Let 119892(119897)

119895= 119860(119897)

119895119909119895+1 + 119862

(119897)

119895+1119895+2 + 119886

(119897)

119895 then

119892(119897)

119895= 119860(119897)

119895119909119895+1 ⟨4⟩ + 119862

(119897)

119895+1119895+2 ⟨3⟩ + 119886

(119897)

119895⟨1⟩ (49)

Thus we obtain

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205744

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(50)

According to Lemma 9 we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745119899minus1 (1 + 1205744)

times

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816a(119897)119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(51)

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 6: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

6 Journal of Applied Mathematics

function [119909 119910] = 119865119886119904119905119879119908119900119878119906119898(119886 119887)

119909 = 119886 oplus 119887

119910 = (119886 ⊖ 119909) oplus 119887

Algorithm 8 EFT of the sum of two floating point numbers (|119886| ge

|119887|)

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886ℎ 119887)

119905119897 = 119886119897 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 9 Addition of a double-double number and a doublenumber

function [119903ℎ 119903119897] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119904ℎ 119904119897] = 119879119908119900119878119906119898(119886ℎ 119887ℎ)

[119905ℎ 119905119897] = 119879119908119900119878119906119898(119886119897 119887119897)

119904119897 = 119904119897 oplus 119905ℎ

119905ℎ = 119904ℎ oplus 119904119897

119904119897 = 119904119897 ⊖ (119905ℎ ⊖ 119904ℎ)

119905119897 = 119905119897 oplus 119904119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 10 Addition of a double-double number and a double-double number

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889(119886ℎ 119886119897 119887)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887)

119905119897 = 119886119897 otimes 119887 oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 11 Multiplication of a double-double number by adouble number

then119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

times

119899minus1

sum

119895=0

(

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896minus119895 (|119909|)) 119901119895 (|119909|)

(37)

According to Lemma 5 we obtain

119899minus1

sum

119895=0

120590119895119901119895 (|119909|) le 120596119895 (1 + 1205745(119899minus1))

119899minus1

sum

119895=0

119899

sum

119896=119895

10038161003816100381610038161198861198961003816100381610038161003816 119901119896 (|119909|)

le 119899120596119895 (1 + 1205745(119899minus1))

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(38)

Among the perturbed and round-off errors inAlgorithm 5 we deem that some errors do not influence thenumerical result in working precision Now we can give theperturbed error bounds and the round-off error boundsrespectively At first we analyze the perturbed error in (24)Let 119892(119897)

119895= 119860(119897)

119895119909119895+1+119862

(119897)

119895+1119895+2+119886

(119897)

119895 According to119860

(119897)le 119906119860(ℎ)

and Remark 7 we obtain10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816le 119906 (1 + 1205741) (119860119895 |119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816) (39)

Then let 120596119895 = 119906(1 + 1205741) and from Lemma 10 taking intoaccount that (119899+1)119906(1+1205745119899+1) le (5119899+1)119906(1+1205745119899+1) = 1205745119899+1we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (40)

1205745119899+1 is 119874(119906) so this coefficient perturbation may influ-ence the accuracy we need to consider it in our compensatedalgorithm

Similarly we let 119892(119898)

119895= 119860(119898)

119895119909119895+1 + 119862

(119898)

119895+1119895+2 + 119886

(119898)

119895 then

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119898)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1199061205745119899+1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (41)

1199061205745119899+1 is 119874(1199062) so this coefficient perturbation does not

influence the accuracy

Remark 11 When 119895 = 119899 the 119899th step of Algorithm 5 is119899 = 119886

(ℎ)

119899 so that we only need to consider the perturbation

of coefficient 119886119899

Next we deduce the round-off error bound Let 119904119895 = 120572119895 +

120573119895 + 120578119895 + 120585119895 According to Theorems 2 and 3 and Remark 7we obtain

10038161003816100381610038161003816120572119895

10038161003816100381610038161003816le (2119906 + 14119906

2)

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1

10038161003816100381610038161003816

le (2119906 + 141199062) (1 + 1205741)

10038161003816100381610038161003816119860119895119909119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119862(ℎ)

119895+1119895+2

10038161003816100381610038161003816le 119906 (1 + 1205741)

10038161003816100381610038161003816119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨3⟩ + 119862

(ℎ)

119895+1119895+2 ⟨2⟩

10038161003816100381610038161003816

le 119906 (1 + 1205743)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2

10038161003816100381610038161003816

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816le 119906

10038161003816100381610038161003816119860(ℎ)

119895119909119895+1 ⟨4⟩ + 119862

(ℎ)

119895+1119895+2 ⟨3⟩ + 119886119895 ⟨1⟩

10038161003816100381610038161003816

le 119906 (1 + 1205744)10038161003816100381610038161003816119860119895119909119895+1 + 119862119895+1119895+2 + 119886119895

10038161003816100381610038161003816

(42)

then10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816

le (4119906 + 141199062)

10038161003816100381610038161 + 12057441003816100381610038161003816

times (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(43)

Journal of Applied Mathematics 7

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887ℎ)

119905119897 = (119886ℎ otimes 119887119897) oplus (119886119897 otimes 119887ℎ) oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 12 Multiplication of a double-double number by adouble-double number

function [119903ℎ 119903119897] = 119889119894V 119889 119889(119886 119887)

119902ℎ = 119886 ⊘ 119887

[119905ℎ1 1199051198971] = 119879119908119900119875119903119900119889(119902ℎ 119887)

[119905ℎ2 1199051198972] = 119879119908119900119878119906119898(119886 minus119905ℎ1)

119902119897 = (119905ℎ2 oplus 1199051198972 ⊖ 1199051198971) ⊘ 119887

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119902ℎ 119902119897)

Algorithm 13 Division of a double number by a double number

Let 120596119895 = (4119906 + 141199062)|1 + 1205744| and using it into Lemma 10

from (4+14119906)119899119906(1+1205745119899minus1) le (5119899minus1)119906(1+1205745119899minus1) = 1205745119899minus1 (119899 ge

2) we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(44)

1205745119899minus1 is 119874(119906) so this round-off error may influence theaccuracy we also need to consider it in our compensatedalgorithm

From Theorem 3 we have known that round-off error|120591119895| le 12057421205746|119860

(ℎ)

119895119909119895+1| le 12057421205746(1 + 1205741)|119860119895119909119895+1| According to

Lemma 10 we let 120596119895 = 12057421205746(1 + 1205741) from 1205742 le 2119906(1 + 1205741) and2119899119906(1 + 1205745119899minus3) le 1205745119899minus3 we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

10038161003816100381610038161003816100381610038161003816100381610038161003816

12059111989510038161003816100381610038161003816119901119895 (119909)

10038161003816100381610038161003816le 12057461205745119899minus3

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (45)

12057461205745119899minus3 is119874(1199062) so this round-off error does not influence

the accuracyObserving the error bounds we described above the

perturbation generated by the third part of coefficients in(18) does not influence the accuracy Thanks to the 119889119894V 119889 119889

algorithm in Appendix B (see Algorithm 13) we only need tosplit the coefficients into two floating point numbers

Applying EFT the 119879ℎ119903119890119890119875119903119900119889 algorithm and the 119889119894V 119889 119889

algorithm considering all errors which may influence thenumerical result in working precision in Algorithm 5 weobtain the compensated Clenshaw algorithm in Algorithm 6

Here we give the error bound of Algorithm 6

Theorem 12 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 (119899 ge 2) and119909 a floating point valueThe forward errorbound of the compensated Clenshaw algorithm is

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

le 1199061003816100381610038161003816119901 (119909)

1003816100381610038161003816 + 21205742

5119899minus2

119899

sum

119895=0

119886119895119875119895 (119909) (46)

Proof From Algorithm 6 we obtain

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(0 oplus 1205980) minus 119901 (119909)

10038161003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (0 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

(47)

where |120598| le 119906According toTheorem 8 we have 119901(119909) = 119900 + 120598119887119900 then

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (119875 (119909) minus 120598119887119900 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

le 119906 |119875 (119909)| + (1 + 119906)10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816

(48)

Next we analyze the bound of |120598119887119900 minus 1205980|Let 119892(119897)

119895= 119860(119897)

119895119909119895+1 + 119862

(119897)

119895+1119895+2 + 119886

(119897)

119895 then

119892(119897)

119895= 119860(119897)

119895119909119895+1 ⟨4⟩ + 119862

(119897)

119895+1119895+2 ⟨3⟩ + 119886

(119897)

119895⟨1⟩ (49)

Thus we obtain

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205744

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(50)

According to Lemma 9 we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745119899minus1 (1 + 1205744)

times

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816a(119897)119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(51)

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 7: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Journal of Applied Mathematics 7

function [119903ℎ 119903119897] = 119901119903119900119889 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

[119905ℎ 119905119897] = 119879119908119900119875119903119900119889(119886ℎ 119887ℎ)

119905119897 = (119886ℎ otimes 119887119897) oplus (119886119897 otimes 119887ℎ) oplus 119905119897

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119905ℎ 119905119897)

Algorithm 12 Multiplication of a double-double number by adouble-double number

function [119903ℎ 119903119897] = 119889119894V 119889 119889(119886 119887)

119902ℎ = 119886 ⊘ 119887

[119905ℎ1 1199051198971] = 119879119908119900119875119903119900119889(119902ℎ 119887)

[119905ℎ2 1199051198972] = 119879119908119900119878119906119898(119886 minus119905ℎ1)

119902119897 = (119905ℎ2 oplus 1199051198972 ⊖ 1199051198971) ⊘ 119887

[119903ℎ 119903119897] = 119865119886119904119905119879119908119900119878119906119898(119902ℎ 119902119897)

Algorithm 13 Division of a double number by a double number

Let 120596119895 = (4119906 + 141199062)|1 + 1205744| and using it into Lemma 10

from (4+14119906)119899119906(1+1205745119899minus1) le (5119899minus1)119906(1+1205745119899minus1) = 1205745119899minus1 (119899 ge

2) we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(44)

1205745119899minus1 is 119874(119906) so this round-off error may influence theaccuracy we also need to consider it in our compensatedalgorithm

From Theorem 3 we have known that round-off error|120591119895| le 12057421205746|119860

(ℎ)

119895119909119895+1| le 12057421205746(1 + 1205741)|119860119895119909119895+1| According to

Lemma 10 we let 120596119895 = 12057421205746(1 + 1205741) from 1205742 le 2119906(1 + 1205741) and2119899119906(1 + 1205745119899minus3) le 1205745119899minus3 we have

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

10038161003816100381610038161003816100381610038161003816100381610038161003816

12059111989510038161003816100381610038161003816119901119895 (119909)

10038161003816100381610038161003816le 12057461205745119899minus3

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (45)

12057461205745119899minus3 is119874(1199062) so this round-off error does not influence

the accuracyObserving the error bounds we described above the

perturbation generated by the third part of coefficients in(18) does not influence the accuracy Thanks to the 119889119894V 119889 119889

algorithm in Appendix B (see Algorithm 13) we only need tosplit the coefficients into two floating point numbers

Applying EFT the 119879ℎ119903119890119890119875119903119900119889 algorithm and the 119889119894V 119889 119889

algorithm considering all errors which may influence thenumerical result in working precision in Algorithm 5 weobtain the compensated Clenshaw algorithm in Algorithm 6

Here we give the error bound of Algorithm 6

Theorem 12 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 (119899 ge 2) and119909 a floating point valueThe forward errorbound of the compensated Clenshaw algorithm is

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

le 1199061003816100381610038161003816119901 (119909)

1003816100381610038161003816 + 21205742

5119899minus2

119899

sum

119895=0

119886119895119875119895 (119909) (46)

Proof From Algorithm 6 we obtain

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(0 oplus 1205980) minus 119901 (119909)

10038161003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (0 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

(47)

where |120598| le 119906According toTheorem 8 we have 119901(119909) = 119900 + 120598119887119900 then

1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)1003816100381610038161003816

=10038161003816100381610038161003816(1 + 120598) (119875 (119909) minus 120598119887119900 + 1205980) minus 119901 (119909)

10038161003816100381610038161003816

le 119906 |119875 (119909)| + (1 + 119906)10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816

(48)

Next we analyze the bound of |120598119887119900 minus 1205980|Let 119892(119897)

119895= 119860(119897)

119895119909119895+1 + 119862

(119897)

119895+1119895+2 + 119886

(119897)

119895 then

119892(119897)

119895= 119860(119897)

119895119909119895+1 ⟨4⟩ + 119862

(119897)

119895+1119895+2 ⟨3⟩ + 119886

(119897)

119895⟨1⟩ (49)

Thus we obtain

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205744

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(50)

According to Lemma 9 we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus1

119899

sum

119895=0

10038161003816100381610038161003816119892(119897)

119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745119899minus1 (1 + 1205744)

times

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816a(119897)119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(51)

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 8: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

8 Journal of Applied Mathematics

function [119903ℎ 119903119897] = 119889119894V 119889119889 119889119889(119886ℎ 119886119897 119887ℎ 119887119897)

1199021 = 119886ℎ ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199021)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119886ℎ 119886119897 minus119905ℎ1 minus1199051198971)

1199022 = 119905ℎ2 ⊘ 119887ℎ

[119905ℎ1 1199051198971] = 119901119903119900119889 119889119889 119889(119887ℎ 119887119897 1199022)

[119905ℎ2 1199051198972] = 119886119889119889 119889119889 119889119889(119905ℎ2 1199051198972 minus119905ℎ1 minus1199051198971)

1199023 = 119905ℎ2 ⊘ 119887ℎ

[1199021 1199022] = 119865119886119904119905119879119908119900119878119906119898(1199021 1199022)

[119903ℎ 119903119897] = 119886119889119889 119889119889 119889(1199021 1199022 1199023)

Algorithm 14 Division of a double-double number by a double-double number

function 119903119890119904 = 119863119863119862119897119890119899119904ℎ119886119908(119901 119909)

119887119899+2 = 119887119899+1 = 0

for 119895 = 119899 minus1 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889(119887(ℎ)

119895+1 119887(119897)

119895+1 119909)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

119895 119860(119897)

119895)

[ℎ3 1198973] = 119901119903119900119889 119889119889 119889119889(119887(ℎ)

119895+2 119887(119897)

119895+2 119862(ℎ)

119895+1 119862(119897)

119895+1)

[ℎ4 1198974] = 119886119889119889 119889119889 119889119889(ℎ2 1198972 ℎ3 1198973)

[119887(ℎ)

119895 119887(119897)

119895] = 119886119889119889 119889119889 119889119889(ℎ4 1198974 119886

(ℎ)

119895 119886(119897)

119895)

end119903119890119904 = [119887

(ℎ)

0 119887(119897)

0]

Algorithm 15 DDClenshaw algorithm of evaluating an Legendreseries in double-double arithmetic

From (50) (51) and 1205745119899minus1(1 + 1205744) + 1205744 le 1205745119899+3 we derive

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus

119899

sum

119895=0

119892(119897)

119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899+3

119899

sum

119895=0

(119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(52)

According to 119860(119897)

le 119906119860(ℎ) and Remark 7 we obtain

119860(119897)

119895|119909|

10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862(119897)

119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886(119897)

119895

10038161003816100381610038161003816

le 119906 (1 + 1205741) (119860119895 |119909|10038161003816100381610038161003816119895+1

10038161003816100381610038161003816+

10038161003816100381610038161003816119862119895+1

10038161003816100381610038161003816

10038161003816100381610038161003816119895+2

10038161003816100381610038161003816+

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816)

(53)

From (53) we use 120596119895 = 119906(1 + 1205741) into Lemma 10 taking intoaccount that 119899119906(1 + 1205745119899minus4) le (5119899 + 1)119906(1 + 1205745119899+1) = 1205745119899+1 and1205745119899+11205745119899+3 le 120574

2

5119899+2 according to (52) we get

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899+2

119899

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(54)

Next we let 119904119895 = 120572119895 + 120573119895 + 120578119895 + 120585119895 then

119904119895 le (1 + 1205743) (10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) (55)

thus10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205743

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(56)

According to Lemma 9 we obtain10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745(119899minus1)minus1

119899minus1

sum

119895=0

10038161003816100381610038161003816119904119895

10038161003816100381610038161003816119901119895 (|119909|)

le 1205745(119899minus1)minus1 (1 + 1205743)

times

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(57)

From (56) (57) and 1205745(119899minus1)minus1(1+1205743)+1205743 le 1205745119899minus3 we derive10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus

119899minus1

sum

119895=0

119904119895119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205745119899minus3

119899minus1

sum

119895=0

(10038161003816100381610038161003816120572119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120573119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120578119895

10038161003816100381610038161003816+

10038161003816100381610038161003816120585119895

10038161003816100381610038161003816) 119901119895 (|119909|)

(58)

From (43) we let 120596119895 = (4 + 14119906)119906|1 + 1205744| and using it intoLemma 10 taking into account that (4 + 14119906)119899119906(1 + 1205745119899minus1) le

(5119899 minus 1)119906(1 + 1205745119899minus1) = 1205745119899minus1(119899 ge 2) and 1205745119899minus31205745119899minus1 le 1205742

5119899minus2 we

have10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 1205742

5119899minus2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|) (59)

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 9: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Journal of Applied Mathematics 9

function 119887 = 119863119863119862119900119899V119890119903119905(119886)

119886 119887 are the vectors of monomial polynomial and orthogonal polynomialrsquos coefficients respectively119887(119899)

= 0119887ℎ(119899)

0= 119886(ℎ)

119899

for 119895 = 119899 minus 1 minus1 0

for 119896 = 0 1 119899 minus 119895

if 119896 = 0

[ℎ1 1198971] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

1119862(119897)

1 119887ℎ(119895+1)

1 119887119897(119895+1)

1)

[ℎ2 1198972] = 119889119894V 119889119889 119889119889(ℎ1 1198971 119860(ℎ)

1 119860(119897)

1)

[119887ℎ(119895)

0 119887119897(119895)

0] = 119886119889119889 119889119889 119889119889(minusℎ2 minus1198972 119886

(ℎ)

119895 119886(119897)

119895)

if 119896 = 1 2 119899 minus 119895 minus 2

[ℎ1 1198971] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

[ℎ2 1198972] = 119901119903119900119889 119889119889 119889119889(119862(ℎ)

119896+1 119862(119897)

119896+1 119887ℎ(119895+1)

119896+1 119887119897(119895+1)

119896+1)

[ℎ3 1198973] = 119889119894V 119889119889 119889119889(ℎ2 1198972 119860(ℎ)

119896+1 119860(119897)

119896+1)

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119886119889119889 119889119889 119889119889(ℎ1 1198971 minusℎ3 minus1198973))

if 119896 ge 119899 minus 119895 minus 1

[119887ℎ(119895)

119896 119887119897(119895)

119896] = 119889119894V 119889119889 119889119889(119887ℎ

(119895+1)

119896minus1 119887119897(119895+1)

119896minus1 119860(ℎ)

119896minus1 119860(119897)

119896minus1)

endend119887 = [119887ℎ

(0) 119887119897(0)

]

Algorithm 16 DDConvert algorithm for the polynomial from power basis to Legendre basis

Combining (54) and (59) we get

10038161003816100381610038161003816120598119887119900 minus 1205980

10038161003816100381610038161003816=

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) +

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909)

minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119904119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119904119895 otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

+

10038161003816100381610038161003816100381610038161003816100381610038161003816

119899minus1

sum

119895=0

119892(119897)

119895119901119895 (119909) minus oplus

119899minus1

sum

119895=0

119892(119897)

119895otimes 119901119895 (119909)

10038161003816100381610038161003816100381610038161003816100381610038161003816

le 21205742

5119899+2

119899minus1

sum

119895=0

10038161003816100381610038161003816119886119895

10038161003816100381610038161003816119901119895 (|119909|)

(60)

From Definitions 4 and 6 and Theorem 12 we easily getthe following corollary

Corollary 13 Let 119901(119909) = sum119899

119895=0119886119895119901119895(119909) be a Legendre series of

degree 119899 and 119909 a floating point value The relative error boundof the compensated Clenshaw algorithm is1003816100381610038161003816119862119900119898119901119862119897119890119899119904ℎ119886119908 (119901 119909) minus 119901 (119909)

10038161003816100381610038161003816100381610038161003816119901 (119909)

1003816100381610038161003816

le 119906 + 21205742

5119899+2condrel (119901 119909)

(61)

4 Numerical Results

All our experiments are performed using IEEE-754 dou-ble precision as working precision Here we consider the

polynomials in Legendre basis with real coefficients andfloating point entry 119909 All the programs about accuracymeasurements have been written in MATLAB R2012b andthat about timing measurements have been written in C codeon a 253-GHz Intel Core i5 laptop

41 Evaluation of the Polynomial in Legendre Basis In orderto construct an ill-conditioned polynomial we consider theevaluation of the polynomial in Legendre basis 119901(119909) =

sum17

119894=0119886119894119901119894(119909) converted by the polynomials 119875(119909) = (119909 minus 075)

7

(119909 minus 1)11 in the neighborhood of its multiple roots 075 and

1 We use the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithms and theSymbolic Toolbox to evaluate the polynomial in Legendrebasis In order to observe the perturbation of polynomialcoefficients clearly we propose the 119862119900119899V119890119903119905 algorithm inAppendix A (see Algorithm 7) to obtain the coefficients ofthe Legendre series To decrease the perturbation of thecoefficients we also propose the 119863119863119862119900119899V119890119903119905 algorithm inAppendix B (see Algorithm 16) to store the coefficients indouble-double format That is the coefficients of the polyno-mial evaluated which are obtained by the 119862119900119899V119890119903119905 algorithmand 119863119863119862119900119899V119890119903119905 algorithm are in double format and double-double format respectively In this experiment we evaluatethe polynomials for 400 equally spaced points in the intervals[068 115] [07485 07515] and [0993 1007]

From Figures 1-2 we observe that the polynomial evalu-ated by 119862119897119890119899119904ℎ119886119908 algorithm (on the top figure) is oscillatingand the compensated algorithm is more smooth drawingThe polynomials we evaluated by Symbolic Toolbox (on thebottom of Figures 1-2) are different because the perturbationsof coefficients obtained by the 119863119863119862119900119899V119890119903119905 algorithm aresmaller than those by the 119862119900119899V119890119903119905 algorithm We can seethat the accuracy of the polynomials evaluated by the com-pensated algorithm is the same with evaluated by Symbolic

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 10: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

10 Journal of Applied Mathematics

07 08 09 1 11

x

x x x

minus5

0

5

times10minus10

times10minus10

x

0749 075 0751minus5

0

5times10minus12

times10minus12

x

minus5

0

5

0995 1 1005

times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

x x x

times10minus10 times10minus12

07 08 09 1 11

minus05

0

05

0749 075 0751

minus6

0995 1 100505

1

15times10minus13

minus595

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

CompC

lenshaw

CompC

lenshaw

SymClenshaw

SymClenshaw

SymClenshaw

Figure 1 Evaluation of polynomial converted from119901(119909) = (119909minus075)7(119909minus1)

11 by the119862119900119899V119890119903119905 algorithm in Legendre basis in the neighborhoodof its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox (down)

Toolbox in Figure 1 The polynomials in Legendre basisevaluated by the compensated algorithm are much moresmooth drawing and just a little oscillation in the intervals[07485 07515] in Figure 2 In fact if we use the SymbolicToolbox to get the polynomial coefficients the oscillationwillbe smaller than it is in Figure 2 However this method isexpensive We just need to use the 119863119863119862119900119899V119890119903119905 algorithm toget the coefficients the result obtained by the119862119900119898119901119862119897119890119899119904ℎ119886119908

algorithm is almost the same as that by using the SymbolicToolbox in working precision

42 Accuracy of the Compensated Algorithm The closer tothe root the larger the condition number Thus in thisexperiment the evaluation is for 120 points near the root075 that is 119909 = 075 minus 103

2119894minus85 for 119894 = 1 40 and119909 = 075 minus 113

119894minus85 for 119894 = 1 80 We compare thecompensated algorithmwithmultiple precision library Sincethe working precision is double precision we choose thedouble-double arithmetic [22] (see Appendix B) which isthe most efficient way to yield a full precision accuracy ofevaluating the polynomial in Legendre basis to compare withthe compensated algorithm We evaluate the polynomialsby the 119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algo-rithms in Appendix B (see Algorithm 15) and the SymbolicToolbox respectively so that the relative forward errors canbe obtained by |119901res(119909) minus 119901sym(119909)|119901sym(119909) and the relative

error bounds are described from Corollaries 13 and A2 inAppendix A Then we propose the relative forward errors ofevaluation of the polynomial in Legendre basis in Figure 3 Aswe can see the relative errors of the compensated algorithmand double-double arithmetic are both smaller than 119906 (119906 asymp

116 times 10minus16) when the condition number is less than 10

17And the accuracy of both algorithms is decreasing linearlyfor the condition number larger than 10

17 However the119862119897119890119899119904ℎ119886119908 algorithm cannot yield the working precision theaccuracy of which decreases linearly since the conditionnumber is less than 10

17When the condition number is lagerthan 10

17 the Clenshaw algorithm cannot obtain even onesignificant bit

43 Time Performances We can easily know that the119879119908119900119878119906119898 119879119908119900119875119903119900119889 and 119865119886119904119905119879119908119900119878119906119898 algorithms inAppendix B (Algorithm 8) require 6 17 and 3 flopsrespectively Then we obtain the computational cost of the119862119897119890119899119904ℎ119886119908 119862119900119898119901119862119897119890119899119904ℎ119886119908 and 119863119863119862119897119890119899119904ℎ119886119908 algorithms

(i) 119862119897119890119899119904ℎ119886119908 5n-2 flops(ii) 119862119900119898119901119862119897119890119899119904ℎ119886119908 79n-29 flops(iii) 119863119863119862119897119890119899119904ℎ119886119908 110n-44 flops

Considering the previous comparison of the accuracy weobserve that 119862119900119898119901119862119897119890119899119904ℎ119886119908 is as accurate as 119863119863119862119897119890119899119904ℎ119886119908

in double precision but it only needs about 718 of flops

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 11: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Journal of Applied Mathematics 11

07 08 09 1 11

07 08 09 1 11

minus05

minus5

0

0

0

05

minus05

05

5

minus5

0

5

0749 075 0751

0749 075 0751

0995 1 1005

x

x

x

x

0749 075 0751

x

x

0995 1 1005

x

times10minus10

times10minus10

times10minus12 times10minus12

1

07 08 09 1 11

0

minus05

05

0

minus5

5

x

times10minus101

0

1

0

2

minus1 minus2

0995 1 1005

x

0

2

minus2

times10minus27 times10minus22

times10minus22times10minus36

Clen

shaw

Clen

shaw

Clen

shaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

CompC

lenshaw

SymClenshaw

Figure 2 Evaluation of polynomial converted from 119901(119909) = (119909 minus 075)7(119909 minus 1)

11 by the 119863119863119862119900119899V119890119903119905 algorithm in Legendre basis in theneighborhood of its multiple roots using the Clenshaw algorithm (up) the 119862119900119898119901119862119897119890119899119904ℎ119886119908 algorithm (middle) and Symbolic Toolbox(down)

counting on average We also implement 119862119900119898119901119862119897119890119899119904ℎ119886119908

and 119863119863119862119897119890119899119904ℎ119886119908 by using Microsoft Visual C++ 2008 onWindows 7 Similar to the statement in [23] we assume thatthe computing time of these algorithms does not dependon the coefficients of polynomial in Legendre basis nor theargument 119909 So we generate the tested polynomials withrandom coefficients and arguments in the interval (minus1 1)whose degrees vary from 20 to 10000 by the step 50 Theaverage measured computing time ratio of 119862119900119898119901119862119897119890119899119904ℎ119886119908

to 119863119863119862119897119890119899119904ℎ119886119908 in C code is 5829 The reason why themeasured computing time ratio is better than the theoreticalflop count one can be referred to the analysis in terms ofinstruction level parallelism (ILP) described in [24 25]

5 Conclusions

This paper introduces a compensated Clenshaw algo-rithm for accurate evaluation of the finite Legendre seriesThe 119862119897119890119899119904ℎ119886119908 algorithm is not precise enough for anill-conditioned problem especially evaluating a polynomialin the neighborhood of a multiple root However this newalgorithm can yield a full precision accuracy in working pre-cision as the same as the original Clenshaw algorithm usingdouble-double arithmetic and rounding into the workingprecision Meanwhile this compensated Clenshaw algorithm

is more efficient which means that it is much more useful toaccurately evaluate the polynomials in Legendre basis for ill-conditioned situations

Appendices

A The Coefficients Conversion Algorithmfrom Polynomial in Power Basis toPolynomial in Legendre Basis

In order to design ill-conditioned problem of the polynomialevaluation we evaluate a polynomial in the neighborhood ofa multiple root Thus we need an algorithm for convertinga polynomial in power basis to the polynomial in Legendrebasis Motivated by [26] the conversion algorithm can bededuced as follows

Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896 be the

polynomials in power basis and Legendre basis respectivelyaccording to

119901119899+1 = 119860119899119909119901119899 + 119862119899119901119899minus1

997904rArr 119909119901119899 =1

119860119899119901119899+1 minus

119862119899

119860119899119901119899minus1 (119899 gt 1)

1199011 = 11986001199091199010 997904rArr 1199091199010 =1

11986001199011

(A1)

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 12: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

12 Journal of Applied Mathematics

100

10minus5

10minus10

10minus15

1010 1020 1030

Condition number

Relat

ive f

orw

ard

erro

r

1205744n(n+1)cond

Clenshaw

u + 212057425n+2cond

CompClenshawDDClenshaw

Figure 3 Accuracy of evaluation of polynomial converted from119901(119909) = (119909minus075)

7(119909minus1)

11 by the119863119863119862119900119899V119890119903119905 algorithm in Legendrebasis with respect to the condition number

we have

119901119899 =

119895minus1

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895

sum

119896=0

119887(119895)

119896119901119896 (119909)

equiv

119895

sum

119896=0

119886119896119909119896

+ 119909119895

119899minus119895minus1

sum

119896=1

119887(119895+1)

119896(

1

119860119896119901119896+1 minus

119862119896

119860119896119901119896minus1)

+ 119909119895+1

119887(119895+1)

01199010

(A2)

Thus we get Algorithm 7

Theorem A1 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively The forward error bound of Algorithm 7 is

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus110038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A3)

Proof According to Definition 1 and Remark 7 we have

119887(119895)

0= 119886119895 ⟨1⟩ minus

1198621

1198601119887(119895+1)

1⟨5⟩ (119896 = 0)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨3⟩ minus

119862119896+1

119860119896+1119887(119895+1)

119896+1⟨5⟩

(119896 = 1 119899 minus 119895 minus 2)

119887(119895)

119896=

1

119860119896minus1119887(119895+1)

119896minus1⟨2⟩ (119896 ge 119899 minus 119895 minus 1)

(A4)

When 119895 = 119899 minus 1 we get that

119887(119899minus1)

0= 119886119899minus1

119887(119899minus1)

1=

119886119899

1198600⟨2⟩

(A5)

Hence we can obtain

119895 119896 0 1 2 3 sdot sdot sdot 119899 minus 2 119899 minus 1

119899 minus 1

119899 minus 2

119899 minus 3

119899 minus 4

0

(((

(

⟨7⟩

⟨7⟩

⟨15⟩

⟨8 [

119899

2] minus 1⟩

⟨2⟩

⟨2⟩

⟨10⟩

⟨10⟩

⟨8 [

119899 minus 1

2] + 2⟩

0

⟨4⟩

⟨4⟩

⟨13⟩

⟨8 [

119899

2] minus 3⟩

0

0

⟨6⟩

⟨6⟩

⟨8 [

119899 minus 1

2]⟩

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

sdot sdot sdot

0

0

0

0

⟨2119899 minus 2⟩

0

0

0

0

⟨2119899⟩

))))

)

(A6)

Then we have

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 120574max8[1198992]minus18[(119899minus1)2]+210038161003816100381610038161003816119887(0)10038161003816100381610038161003816

(A7)

According to the properties of Definition 1 we obtain

120574max8[1198992]minus18[(119899minus1)2]+2 le 1205744119899minus1 (A8)

thus

10038161003816100381610038161003816(0)

minus 119887(0)10038161003816100381610038161003816

le 1205744119899minus1 (A9)

According to Theorem A1 and Theorem 35 in [21] weobtain the following corollary

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 13: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Journal of Applied Mathematics 13

Corollary A2 Let 119875(119909) = sum119899

119896=0119886119896119909119896 and 119901(119909) = sum

119899

119896=0119887(0)

119896119901119896

be the polynomials in power basis and Legendre basis respec-tively Then the relative error bound of Clenshaw algorithm byusing the 119862119900V119890119903119905 algorithm is

1003816100381610038161003816119862119897119890119899119904ℎ119886119908 (119901 x) minus 119901 (119909)1003816100381610038161003816

1003816100381610038161003816119901 (119909)1003816100381610038161003816

le 1205744119899(119899+1)condrel (119901 119909) (A10)

B Double-Double Library

The double-double arithmetic is based on Algorithms 8ndash14[27] Algorithms 15 and 16 are Algorithms 5 and 7 in double-double arithmetic respectively

Conflict of Interests

The authors declare that there is no conflict of interestsregarding the publication of this paper

Acknowledgments

This work is partially supported by the Science Project ofNational University of Defense Technology (JC120201) andthe National Natural Science Foundation of Hunan Provincein China (13JJ2001)

References

[1] J C Mason and D C Handscomb Chebyshev PolynomialsChapman amp HallCRC Boca Raton Fla USA 2003

[2] D Gottlieb and S A Orszag Numerical Analysis of Spec-tral Methods Theory and Applications vol 26 of CBMS-NSFRegional Conference Series in Applied Mathematics Society forIndustrial and Applied Mathematics Philadelphia Pa USA1977

[3] L N Trefethen Approximation Theory and ApproximationPractice SIAM Philadelphia Pennsylvania 2013

[4] CWClenshaw ldquoAnote on the summation ofChebyshev seriesrdquoMathematical Tables and Other Aids to Computation vol 9 pp118ndash120 1955

[5] R Barrio ldquoA unified rounding error bound for polynomialevaluationrdquo Advances in Computational Mathematics vol 19no 4 pp 385ndash399 2003

[6] J Oliver ldquoRounding error propagation in polynomial evalua-tion schemesrdquo Journal of Computational andAppliedMathemat-ics vol 5 no 2 pp 85ndash97 1979

[7] R Barrio ldquoA matrix analysis of the stability of the ClenshawalgorithmrdquoExtractaMathematicae vol 13 no 1 pp 21ndash26 1998

[8] R Barrio ldquoRounding error bounds for the Clenshaw andForsythe algorithms for the evaluation of orthogonal polyno-mial seriesrdquo Journal of Computational andAppliedMathematicsvol 138 no 2 pp 185ndash204 2002

[9] M Skrzipek ldquoPolynomial evaluation and associated polynomi-alsrdquo Numerische Mathematik vol 79 no 4 pp 601ndash613 1998

[10] A Smoktunowicz ldquoBackward stability of Clenshawrsquos algo-rithmrdquo BIT Numerical Mathematics vol 42 no 3 pp 600ndash6102002

[11] T Ogita S M Rump and S Oishi ldquoAccurate sum and dotproductrdquo SIAM Journal on Scientific Computing vol 26 no 6pp 1955ndash1988 2005

[12] S Graillat P Langlois and N Louvet ldquoCompensated Hornerschemerdquo Research Report RR2005-04 LP2A University ofPerpignan Perpignan France 2005

[13] H Jiang S Graillat C Hu et al ldquoAccurate evaluation of the119896-th derivative of a polynomial and its applicationrdquo Journal ofComputational and Applied Mathematics vol 243 pp 28ndash472013

[14] H Jiang S Li L Cheng and F Su ldquoAccurate evaluation of apolynomial and its derivative in Bernstein formrdquo Computers ampMathematics with Applications vol 60 no 3 pp 744ndash755 2010

[15] H Jiang R Barrio H Li X Liao L Cheng and F SuldquoAccurate evaluation of a polynomial in Chebyshev formrdquoApplied Mathematics and Computation vol 217 no 23 pp9702ndash9716 2011

[16] D H Bailey R Barrio and J M Borwein ldquoHigh-precisioncomputation mathematical physics and dynamicsrdquo AppliedMathematics and Computation vol 218 no 20 pp 10106ndash101212012

[17] N J Higham Accuracy and Stability of Numerical AlgorithmSociety for Industrial and Applied Mathematics PhiladelphiaPa USA 2nd edition 2002

[18] D E KnuthTheArt of Computer Programming SeminumericalAlgorithms Addison-Wesley Reading Mass USA 3rd edition1998

[19] T J Dekker ldquoA floating-point technique for extending theavailable precisionrdquo Numerische Mathematik vol 18 pp 224ndash242 1971

[20] S Graillat ldquoAccurate floating-point product and exponentia-tionrdquo IEEE Transactions on Computers vol 58 no 7 pp 994ndash1000 2009

[21] R Barrio H Jiang and S Serrano ldquoA general condition numberfor polynomialsrdquo SIAM Journal on Numerical Analysis vol 51no 2 pp 1280ndash1294 2013

[22] X Li JWDemmel DH Bailey et al ldquoDesign implementationand testing of extended and mixed precision BLASrdquo ACMTransactions on Mathematical Software vol 28 no 2 pp 152ndash205 2002

[23] S Graillat P Langlois and N Louvet ldquoAlgorithms for accuratevalidated and fast polynomial evaluationrdquo Japan Journal ofIndustrial and AppliedMathematics vol 26 no 2-3 pp 191ndash2142009

[24] N Louvet Compensated algorithms in floating point arithmeticaccuracy validation performances [PhD thesis] Universitersquo dePerpignan Via Domitia 2007

[25] P Langlois and N Louvet ldquoMore instruction level parallelismexplains the actual efficiency of compensated algorithmsrdquoTech Rep hal-00165020 DALI Research Team University ofPerpignan Perpignan France 2007

[26] ldquoTable of Contents for MATH77mathc90rdquo chapter 113 fromhttpmathalacartecomcmath77 headhtml

[27] Y Hida X S Li and D H Bailey ldquoAlgorithms for quad-doubleprecision floating point arithmeticrdquo in Proceedings of the 15thIEEE Symposium on Computer Arithmetic pp 155ndash162 VailColo USA June 2001

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 14: Research Article Accurate Evaluation of …downloads.hindawi.com/journals/jam/2014/742538.pdfResearch Article Accurate Evaluation of Polynomials in Legendre Basis PeibingDu, 1 HaoJiang,

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of