Algorithm

3
rI* T1'E MFIIC 43 Algorithrn 33 Mefhod of Frlse P6itioti I Re3d t{, :r, ., ,r ' i;;L ; and :.r are t*o initial glesses to rhe root su'h that "- - - tt" tlt.r"ll " 'ign Lfrrr)' The pres'rib€d pt€{ bion i' e iia,-;' tli.rr-'."' *mb€r ot iterarrons ste!:2 and 3 are ifliriali4lion sleps' 2 Jo <- f Oo) a f.t i=ltan in stepsof Id, s '? 4- (4h - '\Jo\/6 - laJ 6 J, < f(') ^ iftJ.l<ethen 8 begia wrili'convergent solulion" t?'t 9 10 11 12 13 l4 15 wrie Does nol converge in ' irer3lio s' - 1 6 Write .r?, /, l7 Slop 'ft. mo! oll -:5 = O is numerlcally lound using Algorithm 3_3 belo* Corp." Oi _"ltL U".",ion melhod ro see dre gpeed ol convergen:e ta the Je)=;-2s=a Table 3.i gives $e values oilrr;ables oblained bv using Algo'iL\61 3 3 TABLE 33 faie P6idon Merhod J, srop er1 rr'sirn C, * sgn ci|c) Ihen begin rt e t2 1 a- J2 erd eLse begin xn .- x2 fa <- f2 end -21 4.8 - 1.96 6.58r- 4.9121 -.2'182 4.E)6\ -.039 4.999.1 -.0053 - 1-96 r8.18 -.21X2 -.039 -.casL-/ .0r114 z.a 4.8- . 4.g',t?l 4.996i 4_9994 LA 24. 1838 6J!l 1 2 3 5

description

Algorithm

Transcript of Algorithm

Page 1: Algorithm

rI* T1'E MFIIC 43

Algorithrn 33 Mefhod of Frlse P6itioti

I Re3d t{, :r, ., ,r' i;;L ; and :.r are t*o initial glesses to rhe root su'h that"- - - tt" tlt.r"ll " 'ign Lfrrr)' The pres'rib€d pt€{ bion i' e

iia,-;' tli.rr-'."' *mb€r ot iterarrons ste!:2 and

3 are ifliriali4lion sleps'

2 Jo <- f Oo)

a f.t i=ltan in stepsof Id,s '?

4- (4h - '\Jo\/6 - laJ

6 J, < f(')^ iftJ.l<ethen8 begia wrili'convergent solulion" t?'t9

1011

12

13

l4

15 wrie Does nol converge in ' irer3lio s' -

1 6 Write .r?, /,l7 Slop

'ft. mo! oll -:5 = O is numerlcally lound using Algorithm 3_3 belo*

Corp." Oi _"ltL

U".",ion melhod ro see dre gpeed ol convergen:e ta the

Je)=;-2s=aTable 3.i gives $e values oilrr;ables oblained bv using Algo'iL\61 3 3

TABLE 33 faie P6idon Merhod

J,

srop er1rr'sirn C, * sgn ci|c)

Ihen begin rt e t2

1 a- J2 erdeLse begin xn .- x2

fa <- f2 end

-214.8 - 1.96

6.58r-4.9121 -.2'1824.E)6\ -.0394.999.1 -.0053

- 1-96r8.18

-.21X2-.039-.casL-/

.0r114

z.a4.8-

.

4.g',t?l4.996i4_9994

LA 24.

18386J!l1

23

5

Page 2: Algorithm

J8 cowLr-i

Algo.ilhm 1.1 Nepton-Rrphson Iletnod

I Rdd ir, epsilon, Cel|a. IRenatkst ra js he inirial guess, cpsiton is rhc prescrib.d retauve

e.ror, d.it! is lle p.cscribeLl loEer bound ior/,and nthe mrxinum numbe. of iler-iiions ro be d]lo$.ed.S6errenrs 3 ro I are reFaEd unrrt dre p.ocerlu.e convereesto a roor or irerarjons equrl ,.

2 Jbr' = \ ro a in scps ol I do\ n. J)a j:l+i tta)5 ij I i;) < della rlen coro I I6 ; e \ - lfa/j;)i ii tt' .to)/.!, < epsilirn the^ .ora t33 rr eJr

9 \\'.;!9 'Doer no! cDn\ergc in a iterations , ;ir, r.;,rrrll0 Srop

1l Wrjle Slop€ loo smlrll' .ro, rr0, fi, i12 Slop.- wr.e .on.ers .r so _Uon . rr. . )r .,1,1 Srop

.:.\\ e " i l l

" - arr- o l \ e r."-n onl t - a -, - 0 to rllJ:u" r \<11.n Rip ,1

../3.6

Ffi

gor

O!!.Pi.

'ti:

iEmlion nedlcd. We Eili follow Aleorilhm 3.4-

fe)=?_1.s=o: f'G)=2tSirung value :i = 7.

The iierarons are sho*r in Table 3.4-

TAI]LE 3.4 l]uEalins Newton,RlphioR \1eGoc

I23

75.:8i7j rlol05.1\1,\l

5.?3575.00705.!0005 00({)

24?.9i86 .

0 07000

1.1'la.57t1 .

l a.0r.110

.ilrz

.0i:t

.c.-li,10

Obsene tha! c ur t}e bi.ection ,nd 'alsr po .Lor n drod \es.onton melhod corverlas

Page 3: Algorithm

50 cor@r..€R

qlll rily -qlich

woltd lerd :o los .f s.8n. clnt djgrl!. An-urBble for compuLaron is:

- ,afc) -,,/t'. ,t

IC) - I tx-, )(3.13)'

Ne.*1on-R-aphson me$odjrtFn is tu! on he number of;ie.alons o leallowen / ,/-

An algo.;Lhm (o implemenr me ,e.3nr merhod rs given a5 Atgorirhm .1.5. Tle.sruienl ihould nole Lhi e:,! provided +ten lJ.,r,) _,ftr;_rr ,s * *n,. *e .cnlc.ron u\ed ro check converseFce is to check iil,.).( smarl. fiiscnler.on rs more aDolop.rdre as in lhis meL\od.uc{essi"e vrrue, ot r,.s tendt0 fal on erl}ler side ot $e ro,r( qhen a rooL:" ap!rca(hed ]nd che{iios r,\ev"lue orl.,0) nidhr read ro an e"rLer end "r;. ,".",:* .."r".'i, ii,,r.

Algorit

Rema.tr. xn, are rro lnjdal guesses !o the rool e is fie lrescrlb€dp.e.ision. delB t\e minjnum ajlo*ed value oislooe an<iI rie n,rimum nunb€r of i€ndons !o b€ pe.mitred-2 kef\a)3 /' e/(rr)

,R?rortt: Sratementl 5 |o tZ are rep€3led util d.re pir:edur converEesto a .oat or ite.adons erceed ,

1 fa, I=1ton inslepsoit d,5 ,f lf, - fal < dejta then corc rsg rr - tlli . r;a,n\ _ tu.^7 f1 + J lrLt6 l/ lr:t< e then cqa tj9 .f" a_ f,

1.4 A ._ f111 :o e .rr12 \ €,1

tl wrlte Doe. nor .on"e.ge,a,:r,/0,,114 Srcpt5 wnte Stopr. roo mcjl . i,/c i. &, :rt6 S'upl7 Wnl€ Con,ergen( elruon'. i. !r.16l8 Stop

Flnd lbe srnallesr _cosirive roat of rhe loloving eqEadon

'le) =,r -3!+x+ t =o