Description

iterte.mcd Introduction to successive itertion nd open the door to numericl methods with the squre root emple. This worksheet includes severl nimtion clips on successive itertion. Instructor: Nm Sun Wng

Information

Category:
## Kids & Toys

Publish on:

Views: 30 | Pages: 16

Extension: PDF | Download: 0

Share

Transcript

iterte.mcd Introduction to successive itertion nd open the door to numericl methods with the squre root emple. This worksheet includes severl nimtion clips on successive itertion. Instructor: Nm Sun Wng Successive itertion is etremely common in numericl computtions whether we re trying to find solution to (set of liner or nonliner lgebric equtions, mtri inverse, or ordinry nd prtil differentil equtions. You lso see it in probbility trnsition mtri, chos, nd the genertion of frctl ptterns. The itertive scheme tkes the generl form of g( The bove form llows us to strt with n initil vlue of, plug it into function g, nd the function g will provide us with the net vlue of. We insert the new vlue of bck into f( gin, which will crnk out yet nother for us. We cn repet the process for s mny times s we wish. This process is clled successive itertion or successive pproimtion (in cses where we resort to itertion to compenste for pproimtion. Note tht the bove successive itertion scheme contins purely term on the LHS. Let us illustrte the successive methods with the old-fshioned squre root problem where the objective is to find number such tht. ( Note tht lgebr tells us tht there re two roots. In the following discussion, let us tke s n emple: Of course, we symboliclly denote such number s: or (And the other number s or But wht is its vlue? Here, we wnt to find the squre root without resorting to the squre root key on our clcultor or without clling the built-in squre root opertor/function in numericl pckge. We recll tht *=9 nd 4*4=6, thus the nswer should lie between nd 4. Let's strt with: We hve to dd little bit of correction to. Let this correction be ε. The updted root fter mking the correction is: ε To find ε, we squre both sides of the lst eqution. Remember, we re fter number whose squre is. ε Epnding (mrk the lst eqution nd choose Symbolic Epnd Epression from Mthcd menu yields:.. ε ε ε.. ε ( Substituting the vlues of = nd =, we get: ε.. ε ε. 6 ε iterte.mcd Recll the well known qudrtic formul to solve for ε : ε nd ε Ooops. We end up with n epression tht contins the squre root of, which we originlly set out to solve in the first plce. The problem rises becuse we re trying to solve the qudrtic eqution ( in ε ectly with the qudrtic formul. Since this leds us going in circles, we propose to mke n pproimtion -- the key word in numericl method! Let us drop the ε term from Eqution (... ε (The nottion is bit sloppy here, becuse I cnnot find the pproimtion sign in Mthcd. With this pproimtion, we hve much more mngeble eqution tht does not require the qudrtic formul to find ε : ε. Let us ctully plug some numbers into this formul. ε ε =..67 The net vlue of is: ε =.67 Check: =.8 not quite. Since we hve mde n pproimtion by dropping the ε term, the correction we hve just mde is not n ect one, s we cn see from the check Nevertheless, we re now step closer to the ctul root. The price to py for mking n pproimtion is itertion. Now, is better estimte of sqrt(, let us mke nother correction on top of. We hope the resulting estimte will be n even better one. To find, we follow the sme set of steps s before: squre both sides of the lst eqution, equte it to, nd epnd the squre term... ε.. As before, we mke n pproimting by dropping the term.... Plug in some numbers. ε =..4 iterte.mcd The net vlue of is: =.68 Check: =. lmost. If we re stisfied with the results, we stop here. Otherwise, repet until we re stisfied with the ccurcy. We shll do it just one more time, this time without derivtion. ε ε =..4 6 The net vlue of is: ε = Check: =.9 Mthcd's build-in function gives: = which grees with our vlue to more thn digits. The generl itertion scheme for squre root of is: For N i.. N nd provide, i i i. i Although we hve strted with resonbly close initil guess of, this does not hve to be so. We cn see tht ny nonzero initil guess will eventully led to root with this scheme. (We my need more number of itertions though. Zero is not good initil guess becuse of the problem with division by. For N i.. N A lousy initil guess. i i i. = i Not quite there yet. lst( = Good! Furthermore, different initil guess my led to different root when multiple roots eist. Of course, we know tht *= hs two solutions, positive one nd negtive one, lthough sqrt( refers to the positive root nd -sqrt( refers to the negtive one. Another lousy initil guess from the negtive side. i i i. = i Not quite there yet. lst( = Good, but negtive one. 4 iterte.mcd The sme formul is lso pplicble to different vlues of. i i i =. lst(. Good! i In terms of the generl itertion form of =g( mentioned t the beginning of this worksheet, the itertion fomul is: g( i g i. ( In Mthcd version 6 (not vlid in version, we cn iterte elegntly by defining function recursively. The following function sys if =g( is stisfied, return nd stop; otherwise cll g( to updte nd iterte until convergence. The intended usge is to issue the initil guess s the rgument to the iterte function. iterte( ( g(. ( g(. iterte( g( iterte( =... disply the vlue returned with n initil guess of Another wy of sying the sme thing: iterte( if( g(,, iterte( g( iterte( =... disply the vlue returned with n initil guess of iterte.mcd Visuliztion of Successive Itertion =g(. The solution is where the itertion function g( intersects with the digonl line, which is stright function of. Converging Cse -- Eqution ( g(. N i.. N Animtion section: toggle off the net eqution nd set FRAME=..N. i g i FRAME. N FRAME = 6 Generte the steps for plotting: j.. FRAME floor(.. j floor(..( j Pth to Convergence itertion =,... itertion floor(.. FRAME Click on the following icon to ply n nimtion clip. 4 iterte.vi g( & 4 6 iterte.mcd Let us now follow similr steps to find cubic root of given number. The objective is to find such tht **=. Approimte first, then mke correction. A given number whose cubic root is to be estimted. Initil guess. ε We clculte the correction term ε from ( Symbolic Epnd Epression with Mthcd: ε.. ε.. ε ε Ignore the qudrtic term (ε nd the cubic term (ε :.. ε ε. Plug in some numbers. Updte : ε. ε =.67 ε =.67 Repet the correction couple more times:. ε. Check: =.7 =.4 Check: =. ε = Check: =. Mthcd's built-in routine gives: = It is cler tht the scheme is converging rpidly to n ctul cubic root. Thus, the generl itertion scheme for cubic root of is: For N i.. N nd provide n initil guess, i i i. i 7 iterte.mcd We know from mthemticl theories tht there re three roots to cubic eqution. For =, where is rel number, there is rel root nd two comple roots. To find comple root, we must strt with comple guess:.7i Initil guess. The i here denotes the imginry prt, which is entered by typing i , which is not to be confused with the running i i i. i inde i below. The resulting nswer is very sensitive to the initil guess. In fct, we cn generte n interesting frctl pttern bsed on whether the resulting nswer is the rel number or comple one. lst( = The generl itertion formul for the n-root of given number is: g( n Emple: n 4 with n initil guess of n. n yields the following nswer: i g i lst( = Mthcd's built-in routine gives: = n Below, we present different wy of deriving n itertion formul for finding the squre root of given number. We strt with wht we re trying to chieve. Let us dd to both sides of the eqution.. Divide the bove eqution by so tht we obtin n eqution in the form of =g( suitble for itertion. Thus, the itertion scheme is: g(. (4 Now, let us pply this itertion scheme to Strt with: g =.67 g = : i g i lst( = 8 iterte.mcd A close inspection shows tht Eqution (4 is identicl to Eqution (, which incidentlly is identicl to the Newton's method. The lgebric eqution f( to be solved for is: f( f'(. i i f i f' i Mny numericl methods eist for solving nonliner eqution of the form f(=. Ech one of these iterte bsed on the sme generl form of =g( but different specific functionl form of g(. Thus, deriving good numericl lgorithm is to find n epression of =g(. Who is to sy tht we cnnot derive different formul? There re infinite possibilities. For emple, if we dd term, insted of, to both sides of the eqution t the beginning of this section, the resulting itertion formul would be: g(.. Now, let's pply this new itertion scheme to Strt with: g =. g =.464 : i g i lst( = which is lso eventully converging to the vlue of = 9 iterte.mcd Let us try nother scheme by simply dding term to the both sides of eqution (. This is fvorite trick for mny becuse it quickly converts n lgebric eqution of the form =f( into successive itertion form =g(, which is simply +f(. g( ( Now, let us pply this new itertion scheme to Strt with: g = 4 g = g = 4 : i g i = lst( Hmm... The vlue of is just switching bck nd forth, not t ll converging. Plot for Switching Cse -- Eqution ( N i.. N Animtion section: toggle off the net eqution nd set FRAME=..N i g i FRAME. N FRAME = Generte the steps for plotting: j.. FRAME floor(.. j floor(..( j Pth to Divergence itertion =, itertion floor(.. FRAME Click on the following icon to ply n nimtion clip. iterte.vi g( & iterte.mcd Let us try nother scheme. If we dd.9* to both sides of eqution (, we get: g(.9.9 (6 Strt with: g = 4. g =.79 g =.9 4 g 4 =.68 Oscillting wy from the solution. Hmm... The vlue of is getting lrger nd lrger nd not converging into single number. This is clled divergence. Plot for Diverging Cse -- Eqution (6 N i.. N Animtion section: toggle off the net eqution nd set FRAME=..N i g i FRAME. N FRAME = Generte the steps for plotting: j.. FRAME floor(.. j floor(..( j Pth to Divergence itertion =, itertion floor(.. FRAME Click on the following icon to ply n nimtion clip. g( & iterte.vi iterte.mcd Now, if we dd.* to both sides of eqution (, we get: g(. Strt with: g =.9 g =.4 g = 6. (7 Try different vlues for the denomintor, in plce of.. 4 g 4 =.46 Getting wy from the solution. : i g i = lst( Plot for Diverging Cse -- Eqution (7 floor(.. j floor(..( j Pth to Divergence, g( & iterte.mcd Another esy wy of deriving n itertion epression is to reduce the given lgebric eqution first into the form of f(=. This is lso fvorite step for mny. Since f(=, we cn multiply, divide or do lmost nything to it nd the resulting epression is still. Then, we cn dd term to both side of the eqution to rech n itertion form of =g(. Let us demonstrte this pproch where we divide f( by first, then dd. Step. Reduce = to the form f(= f( Step. Multiply by -/ (or some other epression of.. Step. Add to both sides (which is n esy wy of generting the itertion form =g(.. Step 4. Find g(, which is the RHS of the lst eqution g(. The resulting formul is the sme s tht from the Newton's method. Different numericl lgorithms minly differ in the epression mutiplied to f(= in Step. If we choose to multiply by -./ insted, we get n epression tht hs slower convergence property ner the root. A slower convergence is not necessrily bd. We sometimes prefer slower convergence when we wnt to pproch the root gingerly nd conservtively.. g(. Let us generte some numbers bsed on the bove itertion formul nd visulize convergence grphiclly.. i g i floor(.. j Pth to Convergence floor(..( j itertion = 4 g( & 4 iterte.mcd Of course, not ll itertion formul led to root. On the other hnd, if we choose to multiply by +./, we get divergence.. g(. i g i floor(.. j floor(..( j Pth to Divergence i g i floor(.. j floor(..( j Pth to Divergence g( & itertion = g( & itertion = 4 iterte.mcd When do we chieve convergence nd when do we fce divergence? In generl, we rech convergence when the slope of g( t the point of intersection with is within - to. Furthermore, s shown below, we chieve very fst convergence when the slope of g( is close to. On the other hnd, convergence is slow when the slope of g( is close to or -. Hence, the trick is to come up with n itertion scheme such tht the slope of g( lies within - nd, preferbly close to. If we did not know nything bout the convergence property, we hve bout % chnce on the verge of coming up with converging formul (nd % chnce of diverging one. So if the first try does not work, keep trying different mnipultions to get =g(. The chnces re you will hit one converging formul if you tried often enough. Below, we grphiclly demonstrte these two cses. Cse. slope -- Monotonic convergence to the intersection of nd g( for ll initil guesses i.. g(.9. g u i i j floor(.. j floor(..( j, Convergence -- slope i g i floor(.. j floor(..( j g( & Convergence -- slope g( & g(.. g u i i j floor(.. j Convergence -- slope floor(..( j g( & iterte.mcd Cse b. - slope -- Oscilltory convergence to the intersection of nd g( for ll initil guesses g(.. g u i i j floor(.. j floor(..( j Convergence -- - slope i g i floor(.. j floor(..( j g( & Convergence -- - slope g( & Cse. slope -- Monotonic divergence from the intersection of nd g( for ll initil guesses g(... g u i i j floor(.. j floor(..( j Divergence -- slope. i g i floor(.. j floor(..( j g( & Divergence -- slope g( & 6 iterte.mcd Cse b. slope - -- Oscilltory divergence from the intersection of nd g( for ll initil guesses g(... g u i i j floor(.. j floor(..( j Divergence -- slope -. i g i floor(.. j floor(..( j g( & Divergence -- slope - g( &

Related Search

Similar documents

We Need Your Support

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks