• Aucun résultat trouvé

Dynamical control of converging sequences using Discrete Stochastic Arithmetic

N/A
N/A
Protected

Academic year: 2021

Partager "Dynamical control of converging sequences using Discrete Stochastic Arithmetic"

Copied!
19
0
0

Texte intégral

(1)

HAL Id: hal-02545506

https://hal.archives-ouvertes.fr/hal-02545506

Submitted on 17 Apr 2020

HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires

Dynamical control of converging sequences using Discrete Stochastic Arithmetic

Fabienne Jézéquel

To cite this version:

Fabienne Jézéquel. Dynamical control of converging sequences using Discrete Stochastic Arithmetic.

[Research Report] lip6.2003.012, LIP6. 2003. �hal-02545506�

(2)

Discrete Stochastic Arithmetic

F. Jezequel

Laboratoired'Informatiquede Paris 6- CNRS UMR 7606,

4place Jussieu, 75252 Paris cedex 05,France

F[email protected]

Abstract

Onacomputer,the optimalnumberofiterationsofaconvergingse-

quence canbe determineddynamically usingDiscrete Stochastic Arith-

metic. Computationsareperformeduntilthedierencebetweentwosuc-

cessive iterates isnot signicant. Ifthe sequenceconvergesat leastlin-

early,wecanestimatethesignicantdigitsoftheapproximationcommon

withthe exact limit. Thisstrategy canbe usedfor the computation of

integralswith thetrapezoidal orSimpson'smethod. Asequenceis then

generatedbyhalvingthestepvalueateachiteration,whilethedierence

betweentwosuccessiveiteratesisasignicantvalue. Theexactsignicant

digits ofthe last iterate are thoseof the exactvalue ofthe integral, up

toonebit. Numericalalgorithmsinvolvingseveralsequences,suchasthe

approximationofintegralsonaninniteinterval,canalsobedynamically

controlled.

Key words: convergingsequences,numericalvalidation,quadraturemethods,

trapezoidalmethod,Simpson's method, CESTACmethod, Discrete Stochastic

Arithmetic.

1 Introduction

Manyapproximationmethodsinvolvethecomputationofaconvergingsequence.

The limitis then approximated by one of the iterates. It is often diÆcult to

determinetheoptimal iterate,i.e. the approximationforwhich theglobal er-

ror,consisting of the truncation errorand the round-oerror, is minimal. In

section2, werecall methods and concepts which enable to estimate round-o

errorpropagation:theCESTACmethod,theprinciplesofstochasticarithmetic

and nally Discrete Stochastic Arithmetic (DSA). The theorems presented in

section3enabletocontrolboththetruncationerrorandtheround-oerrorin

thecomputationofaconvergingsequence. Wedescribeastrategyto compute

dynamicallytheoptimaliterate of aconvergingsequence usingDSA. Further-

morewecan determine in theapproximationobtainedwhich exactsignicant

(3)

Undersomeassumptionsonthespeedofconvergenceofthesequence,weshow

that theexactsignicantbitsof the resultobtainedarethose of thelimit, up

to one. In section 4, we present theoretical results established in stochastic

arithmetic and their application to the control of arithmetical operations on

sequencescomputedusingDSA.Insection5,weshowhowthetheoremsestab-

lished in theprevious sectionscanbecombinedto control sequencesin which

each termis the limitof another sequence. Wedescribe astrategywhich can

be used for the computation of improper integrals. The last section presents

numericalexperimentscarriedoutusingDSA.

2 Principles of stochastic arithmetic

2.1 The CESTAC method

Thenumericalqualityofacomputed resultR canbemeasuredbyitsnumber

of exact signicant digits, which is the number of signicant digits it has in

commonwiththeexactresultr, moreprecisely:

Denition1 The number of signicant digits in common between two real

numbersR andrisdenedinIR by

for R6=r,C

R;r

=log

10

R+r

2(R r)

,

8r2IR; C

r;r

=+1.

ThenjR rj=

R+r

2

10 C

R;r

. Forinstance, ifC

R;r

=3,therelativedierence

betweenR andrisoftheorderof10 3

,whichmeansthatRandr havethree

signicantdecimaldigitsin common.

Remark: thevalue ofC

R;r

canseemsurprising ifweconsider thedecimal no-

tations of R and r. Forexample, if R =2:4599976 and r = 2:4600012,then

C

R;r

5:8. Thedierence dueto the sequencesof \0"or\9"is illusive. The

signicant decimaldigits of R and r become actually dierent from thesixth

position.

TheCESTAC (Contr^ole et Estimation Stochastique des Arrondis de Calculs)

method,whichhasbeendevelopedbyLaPorteandVignes[9,11,12], enables

one to estimate C

R;r

without any information about r, using a probabilistic

approachofround-oerrors.

Wedene belowtherandomrounding mode.

Denition2 Each real number x, which is not a oating-point number, is

boundedbytwoconsecutiveoating-pointnumbers:X (roundeddown)andX +

(roundedup). Therandom rounding mode denes the oating-pointnumber X

representingxasbeingoneofthetwovaluesX orX +

withtheprobability1=2.

(4)

dierentresults,dueto dierentround-oerrors.

Ithasbeenproved[2]thatacomputedresultRis modelizedtotherstorder

in2 p

as:

RZ =r+ n

X

i=1 g

i (d)2

p

z

i

(1)

where ris the exactresult, g

i

(d) arecoeÆcientsdependingexclusivelyon the

dataandonthecode,pis thenumberof bitsin themantissaandz

i

areinde-

pendentuniformlydistributedrandomvariablescenteredin[ 1;1].

Fromequation(1),wededucethat:

1. themeanvalueoftherandomvariableRistheexactresultr,

2. thedistributionofR isaquasi-Gaussiandistribution.

ThentodeterminetheaccuracyofR ,Student'stestcanbeused. ThusfromN

samplesR

i

;i=1;2;:::;N,thenumberofdecimalsignicantdigitscommonto

Randrcan beestimatedwiththefollowingequation.

C

R

=log

10 p

N

R

!

; (2)

where

R= 1

N N

X

i=1 R

i

and 2

= 1

N 1

N

X

i=1 R

i R

2

: (3)

is the value of Student's distribution for N 1 degrees of freedom and a

probabilitylevel1 . Thus theimplementationoftheCESTACmethodin a

codeprovidingaresultRconsistsin:

performingN timesthiscodewiththerandomroundingmode. Wethen

obtainN samplesR

i ofR

choosing asthecomputedresultthemeanvalueR ofR

i

,i=1;::;N

estimatingwithequation(2)thenumberofexactdecimalsignicantdigits

ofR .

InpracticeN =2orN =3and =0:05:NotethatforN =2,then

=12:706

andforN=3,then

=4:4303:

In order to validate the method, the theoretical study forces to be able to

estimateat any timethenumericalqualityof someintermediateresults. This

leads to the synchronous implementation of the method, i.e. to the parallel

computation of theN samples R

i

. Inpractice areal number becomes an N-

dimensional set and any operation on these N-dimensional sets is performed

elementperelementusingtherandomroundingmode.

(5)

Stochasticarithmetic[4,6,12]isamodelizationofthesynchronousimplemen-

tationof the CESTAC method. Byusing this implementation, sothat the N

runsofacodetakeplaceinparallel,theN resultsofeacharithmeticaloperation

canbeconsideredasrealizationsofaGaussianrandomvariablecenteredonthe

exactresult. Onecanthereforedeneanewnumber,calledstochastic number,

and a newarithmetic, called stochastic arithmetic, applied to these numbers.

Anequalityconceptandorderrelations,whichtakeintoaccountthenumberof

signicantdigitsof stochastic operandshavealsobeendened.

A stochastic numberX is denoted by m;

2

, where m is the mean valueof

X and its standard deviation. Stochastic arithmetical operations (s+, s ,

s,s=) correspondto terms to therst order in

m

betweentwoindependent

Gaussianrandomvariables.

Denition3 LetX

1

= m

1

; 2

1

and X

2

= m

2

; 2

2

. Stochastic arithmetical

operationson X

1 andX

2

aredenedas:

X

1 s+ X

2

= m

1 +m

2

; 2

1 +

2

2

(4)

X

1

s X

2

= m

1 m

2

; 2

1 +

2

2

(5)

X

1

s X

2

= m

1 m

2

; m 2

2

2

1 +m

2

1

2

2

(6)

X

1 s=X

2

= m

1

=m

2

;

1

m

2

2

+

m

1

2

m 2

2

2

!

with m

2

6=0: (7)

IfX= m;

2

,

exists(dependingonlyon)suchthat

P( X 2[m

;m+

])=1 ; (8)

I

;X

= [m

;m+

] is the condence interval of m at (1 ). The

numberof signicant digits common to all the elements of I

;X

and to m is

lower-boundedby

C

;X

=log

10

jmj

: (9)

When N is a small value (2 or 3), which is the case in practice, the values

obtainedwith equations(2) and (9) are veryclose. This remark is important

forthe useof theconcept of stochastic arithmetic viathe practicaluse of the

CESTACmethod.

2.3 Discrete Stochastic Arithmetic

ThesynchronousimplementationoftheCESTACmethodisessentialtocontrol

branchingstatements. Becauseofround-oerrors,ifAandBaretwocomputed

resultsandaandb thecorrespondingexactvalues,

a>b;A>B and A>B ;a>b:

(6)

ised stopping criterion, innite loop in algorithmic geometry... Taking into

account the numerical quality of the operands in order relations enables to

solvethese problemspartially [3]. Thisrequiresaveryimportantconcept: the

computationalzero,alsonamedinformaticalzero[10].

Denition4 Duringthe run of a code using the CESTACmethod, an inter-

mediate or a nal result R is a computational zero, denoted by @:0, if one of

the twofollowing conditionsholds:

8i;R

i

=0,

C

R 0.

AnycomputedresultR isacomputationalzeroifeitherR=0,R beingsigni-

cant,orR isnotsignicant.

Acomputationalzeroisavaluethatcannot bedierentiatedfrom themathe-

maticalzerobecauseofitsround-oerror. Fromthisconcept,discretestochastic

relationshavebeendened.

Denition5 LetX andY beN-samplesprovidedby theCESTACmethod.

Discretestochastic equalitydenotedby ds=isdenedas:

Xds=Y if X Y =@:0

Discretestochastic inequalitiesdenotedby ds>and dsaredenedas:

Xds>Y if X >Y andX Y 6=@:0,

XdsY if X Y orX Y =@:0.

Discrete Stochastic Arithmetic (DSA) is the joint use on a computer of the

synchronousimplementationoftheCESTACmethod,theconceptofcomputa-

tional zeroand thediscrete stochastic relations. DSA enablesto estimate the

impactof round-o errorson any result of ascienticcode and also to check

that noanomaly occurred during the run,especiallyin branching statements.

DSAisimplementedintheCADNAlibrary 1

.

3 A strategy for a dynamical control of converg-

ing sequences

WhenanumericalalgorithmrequirestheevaluationofthelimitI ofasequence

(I

n

),thislimitisapproximatedbyoneoftheiterates. Thenumberofiterations

performeddependsontheconvergencespeedofthesequence,whichcanbeei-

therlogarithmic, linearorexponential. Asthe numberofiterations increases,

thetruncationerrorusuallydecreases,buttheround-oerrorincreases. There-

forethechoiceoftheoptimaliteratemaybeproblematic. Forsequenceswhich

1

URLaddress:http://www.lip6.fr/cadna/

(7)

comparingthesignicantdigitscommontotwosuccessiveiteratesI

n andI

n+1

todeterminethesignicantdigitscommontoI

n

andthelimitI. Furthermore

if round-o errors can be estimated, the optimal iterate can be dynamically

determinedandthenumberofsignicantdigitsithasincommonwiththelimit

I canbeevaluated.

3.1 Sequences with a linear convergence

Letusconsidertwosuccessiveiteratesofasequence: I

n andI

n+1

. Thenumber

ofsignicantdigitscommontotheseiterates,C

In;In+1

,canbeeasilymeasured.

Iftheconvergencespeedofthesequenceislinear,thefollowingtheoremenables

onetodeducethenumberofsignicantdigitscommontoI

n

andthelimit,C

In;I ,

from C

In;In+1

. This theorem has been establishedby taking into account the

truncationerrorontwosuccessiveiterates,butnottheround-oerroroccurring

duringtheircomputation.

Theorem 1 Let(I

n

)beasequenceconverginglinearlytoI,i.e. whichsatises

I

n

I =C n

+o(

n

)whereC2IRand0<<1,then

C

In;In+1

=C

In;I +log

10

1

1

+o(1):

Proof:

I

n

I =C n

+o(

n

) (10)

ByusingthesameformulaforI

n+1

,oneobtains

I

n I

n+1

=C

n

(1 )+o(

n

) (11)

Fromequation(10),wededuce

I

n

I

n I

=

I

n

C n

(1+o(1))

(12)

I

n

I

n I

= I

n

C n

(1+o(1)) (13)

Therefore

I

n

I

n I

= I

n

C n

+o

1

n

(14)

Then

I

n +I

2(I

n I)

= I

n

I

n I

1

2

= I

n

C n

+o

1

n

(15)

Similarly,fromequation(11),wededuce

I

n +I

n+1

2(I

n I

n+1 )

= I

n

I

n I

n+1 1

2

= I

n

C n

1

1

+o

1

n

(16)

(8)

C

I

n

;I

=log

10

I

n

C n

( 1+o(1))

(17)

C

I

n

;I

=log

10

I

n

C n

+log

10

j1+o(1)j (18)

Therefore

C

I

n

;I

=log

10

I

n

C n

+o(1) (19)

Similarly,fromdenition 1andequation(16)wededuce

C

I

n

;I

n+1

=log

10

I

n

C n

1

1

+o( 1) (20)

Finally

C

I

n

;I

n+1

=C

I

n

;I +log

10

1

1

+o( 1) (21)

Fromthenumberofsignicantdigitsin commonbetweenI

n andI

n+1

,wecan

deducethenumberof signicantdigitsin commonbetweenI

n

andthelimitI.

If the convergence zone is reached, o(1) 1: the last term in equation (21)

becomesnegligible.

80<<1,9k 0<1 1

10 k

and therefore 0<log

10

1

1

k. If the

convergence zone is reached, the signicant digitsin commonbetween I

n and

I

n+1

arealsoin commonwith I, upto kdigits. Theloweris, thefaster the

convergenceofthesequenceisandthelowerkis.

DSAenablesonetoestimatethenumberofexactsignicantdigitsofanycom-

putedresult,i.e. its signicantdigitswhicharenotaectedbyround-oerror

propagation.Letusconsiderthecomputationofthesequence(I

n

)inDSAand

letusassumethattheconvergencezoneisreached. Ifdiscretestochasticequal-

ity isachievedfor twosuccessiveiterates,i.e. I

n I

n+1

=@:0,thedierence

between I

n and I

n+1

is only due to round-o errors. Further iterations are

useless: I

n+1

istheoptimaliterate. Inthis case,theexactsignicantdigitsof

I

n+1

areincommonwithI

n

andtheyarealsoincommonwithI,uptokdigits.

Moreconcisely, if the sequence (I

n

) is computed until the dierence between

twosuccessiveiteratesisnotsignicant,thentheexactsignicantdigitsof the

lastiteratearethoseofI,uptokdigits.

Remark:if0<

1

2

,0<log

2

1

1

1,thenthesignicantbitsincommon

betweenI

n andI

n+1

arealsoincommonwithI,upto one.

(9)

method

Thisstrategycanbeusedforthecomputationofintegralswiththetrapezoidal

orSimpson's method. Indeedasequence which convergeslinearlycanbegen-

eratedbyhalvingthestepvalueateachiteration.

Let f be a real function which is C k

over [a;b] where k 2. Let I

n

be the

approximationofI = R

b

a

f(x)dx computedusing thetrapezoidalmethodwith

steph= b a

2 n

.

Iff 0

(a)6=f 0

(b), thedevelopmentoftheerroruptoorder4is[1,7,8]:

I

n I =

h 2

12 [f

0

(b) f 0

(a)]+O(h 4

) (22)

Thesequence(I

n

)satisesI

n

I =C n

+o(

n

),withC= (b a)

2

12 [f

0

(b) f 0

(a)]

and= 1

4

. Thereforetheorem 1couldapply.

As thesequence (I

n

) actuallysatises I

n

I =C n

+O(

2n

), the following

propertyhasbeenestablishedin [5]:

C

In;In+1

=C

In;I +log

10

4

3

+O

1

4 n

: (23)

Let f be a real function which is C k

over [a;b] where k 4. Let I

n

be the

approximationofI = R

b

a

f(x)dx computed usingSimpson'smethodwith step

h= b a

2 n

.

Iff (3)

(a)6=f (3)

(b),thedevelopmentoftheerroruptoorder6is [1,7,8]:

I

n I =

h 4

180 [f

(3)

(b) f (3)

(a)]+O(h 6

): (24)

Thesequence(I

n

)satises I

n

I =C n

+o(

n

),with C = (b a)

4

180 [f

(3)

(b)

f (3)

(a)]and= 1

16

. Therefore,asforthetrapezoidalmethod,theorem1could

apply.

As thesequence (I

n

) actuallysatises I

n

I =C n

+O(

3

2 n

), thefollowing

propertyhasbeenestablishedin [5]:

C

In;In+1

=C

In;I +log

10

16

15

+O

1

4 n

: (25)

For both methods, if the convergence zone is reached, the signicant digits

commontoI

n andI

n+1

arealsocommonto I, theexactvalueof theintegral,

upto onebit. IfapproximationsI

n

are computed until I

n I

n+1

=@:0, the

exactsignicantbitsofthelastapproximationarethoseofI upto one.

(10)

Thestrategypresentedforsequenceswithalinearconvergenceisalsovalidfor

sequenceswithanexponentialconvergence.Itisbasedonthefollowingtheorem.

Theorem 2 Let(I

n

)beasequenceconvergingtoI inan exponential way, i.e.

which satises I

n

I =C p

n

+o(

p n

) where C 2 IR, 0<<1and p>1,

then

C

In;In+1

=C

In;I +log

10

1

1

p n

(p 1)

+o(1):

Proof:

I

n

I =C p

n

+o(

p n

) (26)

ByusingthesameformulaforI

n+1

,oneobtains

I

n I

n+1

=C

p

n

p

n+1

+o(

p n

) (27)

Fromequation(26),wededuce

I

n

I

n I

=

I

n

C p

n

(1+o(1))

(28)

I

n

I

n I

= I

n

C p

n

(1+o(1)) (29)

Therefore

I

n

I

n I

= I

n

C p

n +o

1

p

n

(30)

Then

I

n +I

2(I

n I)

= I

n

I

n I

1

2

= I

n

C p

n +o

1

p

n

(31)

Similarly,fromequation(27),wededuce

I

n

I

n I

n+1

=

I

n

C

p n

p

n+1

(1+o(1))

(32)

Therefore

I

n

I

n I

n+1

=

I

n

C

p n

p

n+1

+o

1

p

n

(33)

Then

I

n +I

n+1

2(I

n I

n+1 )

= I

n

I

n I

n+1 1

2

=

I

n

C

p n

p

n+1

+o

1

p

n

(34)

Fromdenition1andequation(31)wededuce

C

In;I

=log

10

I

n

C p

n

( 1+o(1))

(35)

Références

Documents relatifs

Our approach, Discrete Stochastic Arithmetic, implemented through the CADNA library, has however a high overhead on execution time, especially for very optimised applications, and

Under the assumption that the special graph Γ has no symmetry and that its marked points are not periodic, we conversely prove that the set of polynomials such that Γ(P ) = Γ defines

Indeed, given a job-shop manufacturing system, this research attempts to address, at the shop-floor level, the discrete dispatching of the machine production rates computed at

A natural question arising from the stochastization procedure of classical dynamical systems, in particular, Lagrangian systems, is to understand what remains from classical

For each type configuration considered, PROMISE tests if the associated computed result satisfies the requested accuracy. A comparison with a high precision reference result

Both the topological and measure-theoretic theory are just nascent, and raise two kind of questions inspired by the symbolic theory: we would like to build examples showing what kind

Our approach, Discrete Stochastic Arithmetic, implemented through the CADNA library, has however a high overhead on execution time, especially for very optimised applications, and

Next in Section 3, we provide a probabilistic interpretation of the numerical scheme, by showing that the numerical solution is equivalent to the value function of a