77
CPE 310: Numerical Analysis for Engineers Chapter 1: Solving Nonlinear Equations Ahmed Tamrawi Copyright notice: care has been taken to use only those web images deemed by the instructor to be in the public domain. If you see a copyrighted image on any slide and are the copyright owner, please contact the instructor. It will be removed.

CPE 310: Numerical Analysis for Engineers

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CPE 310: Numerical Analysis for Engineers

CPE310:NumericalAnalysisforEngineersChapter1:SolvingNonlinearEquations

AhmedTamrawi

Copyrightnotice:carehasbeentakentouseonlythosewebimagesdeemedbytheinstructortobeinthepublicdomain.Ifyouseeacopyrightedimageonanyslideandarethecopyrightowner,pleasecontacttheinstructor.Itwillberemoved.

Page 2: CPE 310: Numerical Analysis for Engineers

Animportantprobleminappliedmathematicsisto:"solve𝑓 đ‘„ = 0"where𝑓 đ‘„ isafunctionof đ‘„

Thevaluesofđ‘„ thatmake𝑓 đ‘„ = 0arecalledtherootsoftheequation orzerosof𝒇

Theproblemisknownasrootfinding orzerofinding

Page 3: CPE 310: Numerical Analysis for Engineers

Weareconcernedaboutsolvingsinglenonlinearequation inoneunknown,where𝑓: ℝ → ℝ

Solutionisscalar đ‘„ forwhich𝑓 đ‘„ = 0

“1-DNonlinearEquation”

Example:𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 forwhichđ‘„ = 0.3604 isoneapproximatesolution

Page 4: CPE 310: Numerical Analysis for Engineers

Theselecturesdescribesomeofthemanymethodsforsolving 𝑓 đ‘„ = 0 bynumericalprocedures where𝑓 đ‘„ is singlenonlinearequation inoneunknown

IntervalHalving(Bisection) SecantMethod

False-PositionMethod

Newton’sMethod Fixed-PointIterationMethod

LinearInterpolationMethods

Page 5: CPE 310: Numerical Analysis for Engineers

IntervalHalving(Bisection)Method

Page 6: CPE 310: Numerical Analysis for Engineers

IntervalHalving(Bisection)Method

Ancientbuteffectivemethodforfindingazeroof𝑓(đ‘„)

Itbeginswithtwovalues forđ‘„ thatbracket aroot

Itdeterminesthattheydobracketarootbecause𝑓(đ‘„) changessigns at

thesetwox-values

if𝑓(đ‘„) iscontinuous,theremustbe atleastonerootbetweenthevalues

Aplotof𝑓(đ‘„) isusefultoknowwheretostart

Page 7: CPE 310: Numerical Analysis for Engineers

REPEATSET đ‘„7 =

(1891:);

IF 𝑓 đ‘„7 𝑓 đ‘„< < 0 THENSET đ‘„; = đ‘„7

ELSESET đ‘„< = đ‘„7

UNTIL (|đ‘„< − đ‘„;| <tol) OR 𝑓 đ‘„7 = 0

‱ đ‘„< andđ‘„; suchthat𝑓 đ‘„< 𝑓 đ‘„; < 0‱ tol:thespecifiedtolerancevalueINPUT

IntervalHalving(Bisection)Algorithm

‱ Thefinalvalueofđ‘„7 approximatestheroot,anditisinerrorbynotmorethan|18?1:|;

‱ Thealgorithmmayproduceafalseroot if𝑓(đ‘„) isdiscontinuouson[đ‘„<, đ‘„;]

NOTES“MaximumError”

Page 8: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„< = 0, đ‘„; = 1 suchthat𝑓 0 𝑓 1 < 0tol = 1𝐾 − 3 OR (0.001)

đ‘„< đ‘„;

Iter 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) 𝒇(𝒙𝟑)MaxError

ActualError

AbsoluteError

1 0.00000 1.00000 -1.00000 1.12320

|đ‘„< − đ‘„;|2 đ‘„CDEFGH − đ‘„7

|đ‘„CDEFGH − đ‘„7|

REPEAT

SET !" = (&'(&))+IF , !" , !- < 0 THEN

SET !+ = !"ELSE

SET !- = !"UNTIL (|!- − !+| <tol) OR , !" = 0

‱ !- and!+ suchthat, !- , !+ < 0‱ tol:thespecified tolerancevalueINPUT

IntervalHalving(Bisection)Algorithm

Page 9: CPE 310: Numerical Analysis for Engineers

Actualđ‘„ = .36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„< = 0, đ‘„; = 1 suchthat𝑓 0 𝑓 1 < 0tol = 1𝐾 − 3 OR (0.001)

đ‘„< đ‘„;

Iter 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) 𝒇(𝒙𝟑)MaxError

ActualError

AbsoluteError

1 0.00000 1.00000 0.50000 -1.00000 1.12320 0.33070 0.50000 -0.13958 0.13958

2 0.00000 0.50000 -1.00000 0.33070

REPEAT

SET !" = (&'(&))+IF , !" , !- < 0 THEN

SET !+ = !"ELSE

SET !- = !"UNTIL (|!- − !+| <tol) OR , !" = 0

‱ !- and!+ suchthat, !- , !+ < 0‱ tol:thespecified tolerancevalueINPUT

IntervalHalving(Bisection)Algorithm

Page 10: CPE 310: Numerical Analysis for Engineers

Actualđ‘„ = .36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„< = 0, đ‘„; = 1 suchthat𝑓 0 𝑓 1 < 0tol = 1𝐾 − 3 OR (0.001)

đ‘„< đ‘„;

Iter 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) 𝒇(𝒙𝟑)MaxError

ActualError

AbsoluteError

1 0.00000 1.00000 0.50000 -1.00000 1.12320 0.33070 0.50000 -0.13958 0.13958

2 0.00000 0.50000 0.25000 -1.00000 0.33070 -0.28662 0.25000 0.11042 0.11042

3 0.25000 0.50000 -0.28662 0.33070

REPEAT

SET !" = (&'(&))+IF , !" , !- < 0 THEN

SET !+ = !"ELSE

SET !- = !"UNTIL (|!- − !+| <tol) OR , !" = 0

‱ !- and!+ suchthat, !- , !+ < 0‱ tol:thespecified tolerancevalueINPUT

IntervalHalving(Bisection)Algorithm

Page 11: CPE 310: Numerical Analysis for Engineers

Actualđ‘„ = .36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„< = 0, đ‘„; = 1 suchthat𝑓 0 𝑓 1 < 0tol = 1𝐾 − 3 OR (0.001)

Iter 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) 𝒇(𝒙𝟑)MaxError

ActualError

AbsoluteError

1 0.00000 1.00000 0.50000 -1.00000 1.12320 0.33070 0.50000 -0.13958 0.13958

2 0.00000 0.50000 0.25000 -1.00000 0.33070 -0.28662 0.25000 0.11042 0.11042

3 0.25000 0.50000 0.37500 -0.28662 0.33070 0.03628 0.12500 -0.01458 0.01458

4 0.25000 0.37500 0.31250 -0.28662 0.03628 -0.12190 0.06250 0.04792 0.04792

5 0.31250 0.37500 0.34375 -0.12190 0.03628 -0.04196 0.03125 0.01667 0.01667

6 0.34375 0.37500 0.35938 -0.04196 0.03628 -0.00262 0.01563 0.00105 0.00105

7 0.35938 0.37500 0.36719 -0.00262 0.03628 0.01689 0.00781 -0.00677 0.00677

8 0.35938 0.36719 0.36328 -0.00262 0.01689 0.00715 0.00391 -0.00286 0.00286

9 0.35938 0.36328 0.36133 -0.00262 0.00715 0.00227 0.00195 -0.00092 0.00092

10 0.35938 0.36133 0.36035 -0.00262 0.00227 -0.00018 0.00098 0.00007 0.00007

11 0.36035 0.36133 0.36084 -0.00018 0.00227 0.00105 0.00049 -0.00042 0.00042

0.36035 − 0.36133 < 0.001 âŸč 0.00098 < 0.001 ToleranceMet

đ‘„< đ‘„;

REPEAT

SET !" = (&'(&))+IF , !" , !- < 0 THEN

SET !+ = !"ELSE

SET !- = !"UNTIL (|!- − !+| <tol) OR , !" = 0

‱ !- and!+ suchthat, !- , !+ < 0‱ tol:thespecified tolerancevalueINPUT

IntervalHalving(Bisection)Algorithm

Page 12: CPE 310: Numerical Analysis for Engineers

Needediterationstoachieveaspecifiedaccuracyisknowninadvance

Errorafter𝑛 iterations< | 1:?18;\

|

Simpleandguaranteed toworkif:1. 𝑓(đ‘„) iscontinuous in[đ‘„<, đ‘„;]; and2. Thevaluesđ‘„< andđ‘„; actuallybracketaroot

Plottingthefunctionhelpsdefiningthebracket

Goodforinitialguessforotherrootfindingalgorithms

REPEAT

SET !" = (&'(&))+IF , !" , !- < 0 THEN

SET !+ = !"ELSE

SET !- = !"UNTIL (|!- − !+| <tol) OR , !" = 0

‱ !- and!+ suchthat, !- , !+ < 0‱ tol:thespecified tolerancevalueINPUT

IntervalHalving(Bisection)Algorithm

Page 13: CPE 310: Numerical Analysis for Engineers

SlowConvergence comparedtoothertechniqueswewillseenext

Othermethodsrequirelessnumberofiterations

Page 14: CPE 310: Numerical Analysis for Engineers

Iter !" !# !$ %(!") %(!#) %(!$) MaxError

ActualError

AbsoluteError

1 0.00000 1.00000 0.50000 -1.00000 1.12320 0.33070 0.50000 -0.13958 0.13958

2 0.00000 0.50000 0.25000 -1.00000 0.33070 -0.28662 0.25000 0.11042 0.11042

3 0.25000 0.50000 0.37500 -0.28662 0.33070 0.03628 0.12500 -0.01458 0.01458

4 0.25000 0.37500 0.31250 -0.28662 0.03628 -0.12190 0.06250 0.04792 0.04792

5 0.31250 0.37500 0.34375 -0.12190 0.03628 -0.04196 0.03125 0.01667 0.01667

6 0.34375 0.37500 0.35938 -0.04196 0.03628 -0.00262 0.01563 0.00105 0.00105

7 0.35938 0.37500 0.36719 -0.00262 0.03628 0.01689 0.00781 -0.00677 0.00677

8 0.35938 0.36719 0.36328 -0.00262 0.01689 0.00715 0.00391 -0.00286 0.00286

9 0.35938 0.36328 0.36133 -0.00262 0.00715 0.00227 0.00195 -0.00092 0.00092

10 0.35938 0.36133 0.36035 -0.00262 0.00227 -0.00018 0.00098 0.00007 0.00007

11 0.36035 0.36133 0.36084 -0.00018 0.00227 0.00105 0.00049 -0.00042 0.00042

Someearlieriterationmayresultonacloserapproximationthanlaterones

đ‘„<đ‘„;

đ‘„7đ‘„â€Č7

đ‘„CDEFGH

đ‘„â€Č7 isclosertođ‘„CDEFGH thanđ‘„7

CloserFurther

CloserFurther

Page 15: CPE 310: Numerical Analysis for Engineers

Whentherearemultipleroots,intervalhalvingmaynotbeapplicable,becausethefunctionmaynotchangesign atpointsoneithersideoftheroots.

Wemaybeabletofindtherootsbyworkingwith𝑓â€Č(đ‘„), whichwillbezeroatamultipleroot.

𝑓 đ‘„ = đ‘„; − 2đ‘„ + 1 = 0,inbracket[0, 2]Example:

Page 16: CPE 310: Numerical Analysis for Engineers

http://mathfaculty.fullerton.edu/mathews/a2001/Animations/RootFinding/BisectionMethod/BisectionMethod.html

BisectionMethod- Animation

Page 17: CPE 310: Numerical Analysis for Engineers

LinearInterpolationMethodsMostfunctionscanbeapproximatedbyastraightlineoverasmallinterval

SecantMethod

Page 18: CPE 310: Numerical Analysis for Engineers

SecantMethod

In geometry,a secant ofa curve isalinethatintersectstwo points onthecurve

Itbeginswithtwovalues forđ‘„ thatarenear the root

Thetwovaluesmaybeonthesamesidefromtherootoronoppositeside

if𝑓(đ‘„) islinear,thesecantintersectsthex-axisattherootexactly

Aplotof𝑓(đ‘„) isusefultoknowwheretostart

𝑓 đ‘„ = 3𝑒1 − 4 cos đ‘„ = 0

Page 19: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH

𝑓 đ‘„

Page 20: CPE 310: Numerical Analysis for Engineers

đ‘„_đ‘„<đ‘„; đ‘„CDEFGH

𝑓 đ‘„<

𝑓 đ‘„_

Page 21: CPE 310: Numerical Analysis for Engineers

đ‘„_đ‘„<đ‘„; đ‘„CDEFGH

𝑓 đ‘„<

𝑓 đ‘„_

𝑓 đ‘„_ − 𝑓(đ‘„<)

đ‘„_ − đ‘„<

đ‘„_ − đ‘„;

Page 22: CPE 310: Numerical Analysis for Engineers

đ‘„_đ‘„<đ‘„; đ‘„CDEFGH

𝑓 đ‘„<

𝑓 đ‘„_

𝑓 đ‘„_ − 𝑓(đ‘„<)

đ‘„_ − đ‘„<

đ‘„_ − đ‘„;

(đ‘„_ − đ‘„;)𝑓(đ‘„_)

=(đ‘„_ − đ‘„<)

𝑓 đ‘„_ − 𝑓(đ‘„<)

Page 23: CPE 310: Numerical Analysis for Engineers

đ‘„; = đ‘„_ − 𝑓 đ‘„_(đ‘„_ − đ‘„<)

𝑓 đ‘„_ − 𝑓(đ‘„<)

(đ‘„_ − đ‘„;)𝑓(đ‘„_)

=(đ‘„_ − đ‘„<)

𝑓 đ‘„_ − 𝑓(đ‘„<)

đ‘„_đ‘„<đ‘„; đ‘„CDEFGH

𝑓 đ‘„<

𝑓 đ‘„_

𝑓 đ‘„_ − 𝑓(đ‘„<)

đ‘„_ − đ‘„<

đ‘„_ − đ‘„;

Page 24: CPE 310: Numerical Analysis for Engineers

IF 𝑓 đ‘„_ < 𝑓 đ‘„< THENSWAP đ‘„_withđ‘„<

REPEATSET đ‘„; = đ‘„_ − 𝑓(đ‘„_)

1b?18c 1b ?c 18

SET đ‘„_ = đ‘„<SET đ‘„< = đ‘„;

UNTIL (|𝑓(đ‘„;)| <tol)

‱ đ‘„_ andđ‘„< thatarenear theroot‱ tol:thespecifiedtolerancevalueINPUT

SecantMethod

‱ Anotherstopping“termination”criteriaiswhenthepairofpointsbeingusedaresufficientlyclosetogether:“UNTIL (|đ‘„_ − đ‘„<| <tol)”

‱ Thealgorithmmayfail if𝑓(đ‘„) isnotcontinuous.

NOTES

Page 25: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0tol = 1𝐾 − 7 OR (0.0000001)

đ‘„< đ‘„_

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 1.000000 0.000000 1.12320 -1.00000

đ‘„;

IF ! "# < ! "% THENSWAP "#with"%

REPEATSET "+ = "# − !("#) 01203

4 01 24 03SET "# = "%SET "% = "+

UNTIL (|!("+)| <tol)

‱ "# and"% thatarenear theroot‱ tol:thespecified tolerancevalueINPUT

SecantMethod

Page 26: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0tol = 1𝐾 − 7 OR (0.0000001)

đ‘„_ đ‘„<

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 1.00000 0.00000 0.4709896 1.12320 -1.000000 0.2651588 -0.110567

2 0.00000 0.4709896 -1.000000 0.2651588

đ‘„;

IF ! "# < ! "% THENSWAP "#with"%

REPEATSET "+ = "# − !("#) 01203

4 01 24 03SET "# = "%SET "% = "+

UNTIL (|!("+)| <tol)

‱ "# and"% thatarenear theroot‱ tol:thespecified tolerancevalueINPUT

SecantMethod

Page 27: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0tol = 1𝐾 − 7 OR (0.0000001)

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 1.00000 0.00000 0.4709896 1.12320 -1.000000 0.2651588 -0.110567

2 0.00000 0.4709896 0.3722771 -1.000000 0.2651588 0.0295336 -0.011849

3 0.4709896 0.3722771 0.2651588 0.0295336

đ‘„< đ‘„_

đ‘„;

IF ! "# < ! "% THENSWAP "#with"%

REPEATSET "+ = "# − !("#) 01203

4 01 24 03SET "# = "%SET "% = "+

UNTIL (|!("+)| <tol)

‱ "# and"% thatarenear theroot‱ tol:thespecified tolerancevalueINPUT

SecantMethod

Page 28: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0tol = 1𝐾 − 7 OR (0.0000001)đ‘„;

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 1.00000 0.00000 0.4709896 1.12320 -1.000000 0.2651588 -0.110567

2 0.00000 0.4709896 0.3722771 -1.000000 0.2651588 0.0295336 -0.011849

3 0.4709896 0.3722771 0.3599043 0.2651588 0.0295336 -0.001294 0.000517

4 0.3722771 0.3599043 0.3604239 0.0295336 -0.001294 0.0000552 -0.000002

5 0.3599043 0.3604239 0.3604217 -0.001294 0.0000552 0.00000003 0.000000002

đ‘„_

đ‘„<

IF ! "# < ! "% THENSWAP "#with"%

REPEATSET "+ = "# − !("#) 01203

4 01 24 03SET "# = "%SET "% = "+

UNTIL (|!("+)| <tol)

‱ "# and"% thatarenear theroot‱ tol:thespecified tolerancevalueINPUT

SecantMethod

ToleranceMet𝑓 đ‘„; < 1E − 7

Page 29: CPE 310: Numerical Analysis for Engineers

Ifthefunctionisfarfromlinearneartheroot,thesuccessiveiteratescanflyoffto

pointsfarfromtheroot

đ‘„_ đ‘„< đ‘„;đ‘„fggE

Page 30: CPE 310: Numerical Analysis for Engineers

Thebadchoiceofđ‘„_ andđ‘„< orduplicatingapreviousresult,mayresultonanendlessloop,

thus,neverreachingananswer

𝑓 đ‘„ = đ‘„đ‘’?1 andđ‘„_ = 2, đ‘„< = 3

Page 31: CPE 310: Numerical Analysis for Engineers

http://mathfaculty.fullerton.edu/mathews/a2001/Animations/RootFinding/SecantMethod/SecantMethod.html

SecantMethod- Animation

Page 32: CPE 310: Numerical Analysis for Engineers

LinearInterpolationMethodsMostfunctionscanbeapproximatedbyastraightlineoverasmallinterval

False-PositionMethod“RegulaFalsi”Method

Page 33: CPE 310: Numerical Analysis for Engineers

False-PositionMethod

ProblemofSecantMethodIfthefunctionisfarfromlinearneartheroot,thesuccessiveiteratescanflyoff

topointsfarfromtheroot

False-Positionbeginswithtwovaluesforđ‘„ thatbracket aroot

Ensurethattherootisbracketedbetweenthetwostartingvaluesandremainsbetweenthesuccessivepairs.

𝑓 đ‘„ = đ‘„7 + 4đ‘„; − 10 = 0

Page 34: CPE 310: Numerical Analysis for Engineers

Similartobisectionexceptthenextiterateistakenattheintersectionofalinebetweenthepairofx-valuesandthex-axisratherthanatthemidpoint

đ‘„_đ‘„<

đ‘„hijklmino

đ‘„CDEFGH

đ‘„pqrjk?snjimino

FasterthanBisectionbutmorecomplicated

đ‘„; = đ‘„_ − 𝑓 đ‘„_(đ‘„_ − đ‘„<)

𝑓 đ‘„_ − 𝑓(đ‘„<)

(đ‘„_ − đ‘„;)𝑓(đ‘„_)

=(đ‘„_ − đ‘„<)

𝑓 đ‘„_ − 𝑓(đ‘„<)

Page 35: CPE 310: Numerical Analysis for Engineers

REPEATSET đ‘„; = đ‘„_ − 𝑓(đ‘„_)

1b?18c 1b ?c 18

IF 𝑓(đ‘„;) isofoppositesignto𝑓(đ‘„_) THEN SET đ‘„< = đ‘„;

ELSESET đ‘„_ = đ‘„<

UNTIL (|𝑓(đ‘„;)| <tol)

‱ đ‘„_ andđ‘„< thatbracketaroot suchthat𝑓(đ‘„_)and𝑓(đ‘„<) areofoppositesign

‱ tol:thespecifiedtolerancevalueINPUT

False-Position(regula falsi)Method

‱ Anotherstopping“termination”criteriaiswhenthepairofpointsbeingusedaresufficientlyclosetogether:“UNTIL (|đ‘„_ − đ‘„<| <tol)”

‱ Thealgorithmmayfail if𝑓(đ‘„) isnotcontinuous.

NOTES

Page 36: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0

đ‘„_ đ‘„<

đ‘„;Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 0.000000 1.000000 -1.000000 1.12320

REPEATSET !" = !$ − &(!$) *+,*-

. *+ ,. *-IF &(!") isofoppositesignto&(!$) THEN

SET !/ = !"ELSE

SET !$ = !/UNTIL (|&(!")| <tol)

‱ !$ and!/ thatbracketaroot suchthat&(!$)and&(!/)areofopposite sign

‱ tol:thespecified tolerancevalueINPUT

False-Position(regula falsi)Method

tol = 1𝐾 − 4 OR (0.0001)

Page 37: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0

đ‘„_ đ‘„<

đ‘„;

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 0.000000 1.000000 0.4709896 -1.000000 1.12320 0.2651588 -0.110567

2 0.000000 0.4709896 -1.000000 0.2651588

REPEATSET !" = !$ − &(!$) *+,*-

. *+ ,. *-IF &(!") isofoppositesignto&(!$) THEN

SET !/ = !"ELSE

SET !$ = !/UNTIL (|&(!")| <tol)

‱ !$ and!/ thatbracketaroot suchthat&(!$)and&(!/)areofopposite sign

‱ tol:thespecified tolerancevalueINPUT

False-Position(regula falsi)Method

tol = 1𝐾 − 4 OR (0.0001)

Page 38: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 0.000000 1.000000 0.4709896 -1.000000 1.12320 0.2651588 -0.110567

2 0.000000 0.4709896 0.3722771 -1.000000 0.2651588 0.0295336 -0.011849

3 0.000000 0.3722771 -1.000000 0.0295336

đ‘„_ đ‘„<

đ‘„;

REPEATSET !" = !$ − &(!$) *+,*-

. *+ ,. *-IF &(!") isofoppositesignto&(!$) THEN

SET !/ = !"ELSE

SET !$ = !/UNTIL (|&(!")| <tol)

‱ !$ and!/ thatbracketaroot suchthat&(!$)and&(!/)areofopposite sign

‱ tol:thespecified tolerancevalueINPUT

False-Position(regula falsi)Method

tol = 1𝐾 − 4 OR (0.0001)

Page 39: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 0.000000 1.000000 0.4709896 -1.000000 1.12320 0.2651588 -0.110567

2 0.000000 0.4709896 0.3722771 -1.000000 0.2651588 0.0295336 -0.011849

3 0.000000 0.3722771 0.361598 -1.000000 0.0295336 0.002941 -0.0011760

đ‘„;

REPEATSET !" = !$ − &(!$) *+,*-

. *+ ,. *-IF &(!") isofoppositesignto&(!$) THEN

SET !/ = !"ELSE

SET !$ = !/UNTIL (|&(!")| <tol)

‱ !$ and!/ thatbracketaroot suchthat&(!$)and&(!/)areofopposite sign

‱ tol:thespecified tolerancevalueINPUT

False-Position(regula falsi)Method

tol = 1𝐾 − 4 OR (0.0001)

Page 40: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0tol = 1𝐾 − 4 OR (0.0001)

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 0.000000 1.000000 0.4709896 -1.000000 1.12320 0.2651588 -0.110567

2 0.000000 0.4709896 0.3722771 -1.000000 0.2651588 0.0295336 -0.011849

3 0.000000 0.3722771 0.36159774 -1.000000 0.0295336 0.002941 -0.0011760

4 0.000000 0.36159774 0.36053740 -1.000000 0.002941 0.00028944 -0.0001157

5 0.000000 0.36053740 0.36043307 -1.000000 0.00028944 0.00002845 0.00001373

đ‘„;

REPEATSET !" = !$ − &(!$) *+,*-

. *+ ,. *-IF &(!") isofoppositesignto&(!$) THEN

SET !/ = !"ELSE

SET !$ = !/UNTIL (|&(!")| <tol)

‱ !$ and!/ thatbracketaroot suchthat&(!$)and&(!/)areofopposite sign

‱ tol:thespecified tolerancevalueINPUT

False-Position(regula falsi)Method

Page 41: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0tol = 1𝐾 − 4 OR (0.0001)

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 0.000000 1.000000 0.4709896 -1.000000 1.12320 0.2651588 -0.110567

2 0.000000 0.4709896 0.3722771 -1.000000 0.2651588 0.0295336 -0.011849

3 0.000000 0.3722771 0.36159774 -1.000000 0.0295336 0.002941 -0.0011760

4 0.000000 0.36159774 0.36053740 -1.000000 0.002941 0.00028944 -0.0001157

5 0.000000 0.36053740 0.36043307 -1.000000 0.00028944 0.00002845 0.00001373

đ‘„;

REPEATSET !" = !$ − &(!$) *+,*-

. *+ ,. *-IF &(!") isofoppositesignto&(!$) THEN

SET !/ = !"ELSE

SET !$ = !/UNTIL (|&(!")| <tol)

‱ !$ and!/ thatbracketaroot suchthat&(!$)and&(!/)areofopposite sign

‱ tol:thespecified tolerancevalueINPUT

False-Position(regula falsi)Method

ToleranceMet𝑓 đ‘„; < 1E − 4

Page 42: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

đ‘„_ = 1đ‘„< = 0tol = 1𝐾 − 5 OR (0.00001)

Iter 𝒙𝟎 𝒙𝟏 𝒙𝟐 𝒇(𝒙𝟎) 𝒇(𝒙𝟏) 𝒇(𝒙𝟐) ActualError

1 0.000000 1.000000 0.4709896 -1.000000 1.12320 0.2651588 -0.110567

2 0.000000 0.4709896 0.3722771 -1.000000 0.2651588 0.0295336 -0.011849

3 0.000000 0.3722771 0.36159774 -1.000000 0.0295336 0.002941 -0.0011760

4 0.000000 0.36159774 0.36053740 -1.000000 0.002941 0.00028944 -0.0001157

5 0.000000 0.36053740 0.36043307 -1.000000 0.00028944 0.00002845 0.00001373

đ‘„;

FalsePositionconvergestotherootfromonlyoneside,slowingitdown,especiallyifthatendoftheintervalisfartherfromtheroot.Thereisawaytoavoidthisresult,calledmodifiedlinearinterpolation

REPEATSET !" = !$ − &(!$) *+,*-

. *+ ,. *-IF &(!") isofoppositesignto&(!$) THEN

SET !/ = !"ELSE

SET !$ = !/UNTIL (|&(!")| <tol)

‱ !$ and!/ thatbracketaroot suchthat&(!$)and&(!/)areofopposite sign

‱ tol:thespecified tolerancevalueINPUT

False-Position(regula falsi)Method

Page 43: CPE 310: Numerical Analysis for Engineers

http://mathfaculty.fullerton.edu/mathews/a2001/Animations/RootFinding/RegulaFalsi/RegulaFalsi.html

False-PositionMethod- Animation

Page 44: CPE 310: Numerical Analysis for Engineers

Newton’sMethodLinearapproximationofthefunctionusingtangentlineoversmallinterval

Page 45: CPE 310: Numerical Analysis for Engineers

Newton’sMethod

Oneofthemostwidelyusedmethodsofsolvingequations

Basedonalinearapproximationofthefunctionusingatangent tothecurve

Startingfromasingleinitialestimate,đ‘„_ thatisnottoofarfromaroot

𝑓 đ‘„ = 3𝑒1 − 4 cos đ‘„

Movealongthetangenttoitsintersectionwiththex-axis,andtake

thatasthenextapproximation

Continueuntileitherthesuccessivex-valuesaresufficientlycloseorthevalueofthefunctionissufficientlynearzero

Page 46: CPE 310: Numerical Analysis for Engineers

đ‘„_đ‘„CDEFGH

đ‘„<

𝜃

Page 47: CPE 310: Numerical Analysis for Engineers

đ‘„< = đ‘„_ −𝑓(đ‘„_)𝑓â€Č đ‘„_

tan Ξ = 𝑓v đ‘„_ =𝑓(đ‘„_)đ‘„_ − đ‘„<

đ‘„_đ‘„CDEFGH

đ‘„<

𝜃

SlopeofTangent at𝑓 đ‘„_ isequaltothederivativeofcurveatđ‘„_

đ‘„o9< = đ‘„o −𝑓(đ‘„o)𝑓â€Č đ‘„o

Page 48: CPE 310: Numerical Analysis for Engineers

COMPUTE 𝑓 đ‘„_ , 𝑓â€Č(đ‘„_)SET đ‘„< = đ‘„_IF 𝑓 đ‘„_ ≠ 0 AND 𝑓â€Č đ‘„_ ≠ 0 THEN

REPEATSET đ‘„_ = đ‘„<SET đ‘„< = đ‘„_ −

c(1b)cv(1b)

UNTIL ( đ‘„< − đ‘„_ <tol1)OR(|𝑓(đ‘„<)| <tol2)

‱ đ‘„_ reasonablyclose totheroot‱ tol1:thespecifiedtolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecifiedtolerancevalueforhowclose𝑓(đ‘„<) tozero.

INPUT

Newton’sMethod

‱ Themethodmayconvergetoarootdifferentfromtheexpectedoneordivergeifthestartingvalueisnotcloseenoughtotheroot.

NOTES

Page 49: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

Webeginwithđ‘„_ = 0.0tol1 = 1𝐾 − 5 OR (0.00001)

đ‘„_

tol2 = 1𝐾 − 5 OR (0.00001)đ‘„<

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 50: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

Webeginwithđ‘„_ = 0.0tol1 = 1𝐾 − 5 OR (0.00001)

đ‘„_

tol2 = 1𝐾 − 5 OR (0.00001)

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 𝑓â€Č đ‘„ = 3 + cos đ‘„ − 𝑒1

đ‘„<

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 51: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

Webeginwithđ‘„_ = 0.0tol1 = 1𝐾 − 5 OR (0.00001)tol2 = 1𝐾 − 5 OR (0.00001)

đ‘„_ = 0.0, đ‘„< = 0.0

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 𝑓â€Č đ‘„ = 3 + cos đ‘„ − 𝑒1

𝑓(đ‘„_) = −1.0, 𝑓â€Č(đ‘„_) = 3.0

đ‘„_

đ‘„<

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 52: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

Webeginwithđ‘„_ = 0.0tol1 = 1𝐾 − 5 OR (0.00001)tol2 = 1𝐾 − 5 OR (0.00001)

đ‘„_ = 0.0, đ‘„< = 0.0𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1

𝑓â€Č đ‘„ = 3 + cos đ‘„ − 𝑒1 𝑓(đ‘„_) = −1.0, 𝑓â€Č(đ‘„_) = 3.0

Iteration1:đ‘„_ = 0.0, đ‘„< = đ‘„_ −c 1bcx 1b

= 0.0 − ?<._7._

= 0.33333

0.33333 − 0.0 < 0.00001𝐎𝐑 −0.068418 < 0.00001

đ‘„_

đ‘„<

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 53: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

Webeginwithđ‘„_ = 0.0tol1 = 1𝐾 − 5 OR (0.00001)tol2 = 1𝐾 − 5 OR (0.00001)

đ‘„_ = 0.0, đ‘„< = 0.0𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1

𝑓â€Č đ‘„ = 3 + cos đ‘„ − 𝑒1 𝑓(đ‘„_) = −1.0, 𝑓â€Č(đ‘„_) = 3.0

Iteration1:đ‘„_ = 0.0, đ‘„< = đ‘„_ −c 1bcx 1b

= 0.0 − ?<._7._

= 0.33333

Iteration2:đ‘„< = 0.33333, đ‘„; = đ‘„< −c 18cx 18

= 0.33333 − ?_._{|}<|;.~}ïżœ7}

= 0.36017

0.36017 − 0.33333 < 0.00001𝐎𝐑 −0.0006279 < 0.00001

đ‘„; đ‘„<

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 54: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

Webeginwithđ‘„_ = 0.0tol1 = 1𝐾 − 5 OR (0.00001)tol2 = 1𝐾 − 5 OR (0.00001)

đ‘„_ = 0.0, đ‘„< = 0.0𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1

𝑓â€Č đ‘„ = 3 + cos đ‘„ − 𝑒1 𝑓(đ‘„_) = −1.0, 𝑓â€Č(đ‘„_) = 3.0

Iteration1:đ‘„_ = 0.0, đ‘„< = đ‘„_ −c 1bcx 1b

= 0.0 − ?<._7._

= 0.33333

Iteration2:đ‘„< = 0.33333, đ‘„; = đ‘„< −c 18cx 18

= 0.33333 − ?_._{|}<|;.~}ïżœ7}

= 0.36017

Iteration3:đ‘„; = 0.36017, đ‘„7 = đ‘„; −c 1:cx 1:

= 0.36017 − ?_.___{;ïżœïżœ;.~_;;{

= 0.3604217

0.3604217 − 0.36017 < 0.00001𝐎𝐑 −0.00000005 < 0.00001

đ‘„7 đ‘„;

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 55: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = 0.36042170296032440136932951583028

𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1 = 0

Webeginwithđ‘„_ = 0.0tol1 = 1𝐾 − 5 OR (0.00001)tol2 = 1𝐾 − 5 OR (0.00001)

đ‘„_ = 0.0, đ‘„< = 0.0𝑓 đ‘„ = 3đ‘„ + sin đ‘„ − 𝑒1

𝑓â€Č đ‘„ = 3 + cos đ‘„ − 𝑒1 𝑓(đ‘„_) = −1.0, 𝑓â€Č(đ‘„_) = 3.0

Iteration1:đ‘„_ = 0.0, đ‘„< = đ‘„_ −c 1bcx 1b

= 0.0 − ?<._7._

= 0.33333

Iteration2:đ‘„< = 0.33333, đ‘„; = đ‘„< −c 18cx 18

= 0.33333 − ?_._{|}<|;.~}ïżœ7}

= 0.36017

Iteration3:đ‘„; = 0.36017, đ‘„7 = đ‘„; −c 1:cx 1:

= 0.36017 − ?_.___{;ïżœïżœ;.~_;;{

= 0.3604217

0.3604217 − 0.36017 < 0.00001𝐎𝐑 −0.00000005 < 0.00001

ActualError=đ‘„ïżœlmïżœqr − đ‘„7 = 0.000000002960324AbsoluteError=|đ‘„ïżœlmïżœqr − đ‘„7| = 0.000000002960324

đ‘„7 đ‘„;

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 56: CPE 310: Numerical Analysis for Engineers

Newton’salgorithmiswidelyusedbecause,atleastinthenearneighborhoodofaroot,itismorerapidlyconvergentthananyofthe

methodsdiscussedsofar

Thenumberofdecimalplacesofaccuracynearlydoublesateachiteration

Page 57: CPE 310: Numerical Analysis for Engineers

Thereistheneedfortwofunctionevaluationsateachstep𝑓 đ‘„ and𝑓â€Č(đ‘„) andwemustobtainthederivativefunctionatthestart

Finding𝑓â€Č(đ‘„)maybedifficult.Computeralgebrasystemscanbearealhelp

Page 58: CPE 310: Numerical Analysis for Engineers

InsomecasesNewton’smethodwillnotconverge

Thebadchoiceofđ‘„_ mayneverleadustoreachananswer;wearestuckinaninfiniteloop

Reachinglocalminimumorlocalmaximum ofthefunction,theanswerwillflyofftoinfinity

𝑓v(đ‘„_) = 0

đ‘„o9< = đ‘„o −𝑓(đ‘„o)𝑓â€Č đ‘„o

đ‘„~ đ‘„7đ‘„fggEđ‘„_ đ‘„; đ‘„} đ‘„<

đ‘„{

Page 59: CPE 310: Numerical Analysis for Engineers

RelatingNewton’stoOtherMethodsLinearInterpolationMethods

đ‘„; = đ‘„_ −𝑓 đ‘„_

𝑓 đ‘„_ − 𝑓(đ‘„<)(đ‘„_ − đ‘„<)

đ‘„; = đ‘„_ −𝑓(đ‘„_)𝑓â€Č đ‘„_

Newton’sMethod

𝑓v đ‘„_ = limïżœâ†’_

𝑓 đ‘„_ + ℎ − 𝑓(đ‘„_)ℎ

đ‘„< = đ‘„_ + ℎ

𝑓v đ‘„_ = lim(18?1b)→_

𝑓 đ‘„< − 𝑓(đ‘„_)đ‘„< − đ‘„_

đ‘„; = đ‘„_ −𝑓(đ‘„_)

lim(18?1b)→_

𝑓 đ‘„< − 𝑓(đ‘„_)đ‘„< − đ‘„_

Thedenominatorofthefractionisanapproximation ofthederivativeatđ‘„_

đ‘„; = đ‘„_ − 𝑓 đ‘„_(đ‘„_ − đ‘„<)

𝑓 đ‘„_ − 𝑓(đ‘„<)

Page 60: CPE 310: Numerical Analysis for Engineers

SecantmethodlookslikeNewton’sanditsgoodtousewhenthederivativeisnoteasytoachieve

SecantMethod Newton’sMethod

đ‘„; = đ‘„_ −𝑓(đ‘„_)𝑓â€Č đ‘„_

đ‘„; = đ‘„_ − 𝑓 đ‘„_(đ‘„_ − đ‘„<)

𝑓 đ‘„_ − 𝑓(đ‘„<)

Page 61: CPE 310: Numerical Analysis for Engineers

Newton’smethodworkswithcomplexrootsifwegiveitacomplexvalueforthestartingvalueđ‘„_

Page 62: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = −2.9259, 0.46293 ± 1.22254𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5 = 0

Webeginwithđ‘„_ = 1 + 𝑖tol1 = 1𝐾 − 4 OR (0.0001)tol2 = 1𝐾 − 4 OR (0.0001)

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 63: CPE 310: Numerical Analysis for Engineers

đ‘„_ = 1 + 𝑖, đ‘„< = 1 + 𝑖

𝑓(đ‘„_) = 2 + 5𝑖, 𝑓â€Č(đ‘„_) = 3 + 10𝑖

đ‘„CDEFGH = −2.9259, 0.46293 ± 1.22254𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5 = 0

Webeginwithđ‘„_ = 1 + 𝑖tol1 = 1𝐾 − 4 OR (0.0001)tol2 = 1𝐾 − 4 OR (0.0001)

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5

𝑓â€Č đ‘„ = 3đ‘„; + 4đ‘„ − 1

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 64: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = −2.9259, 0.46293 ± 1.22254𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5 = 0

Webeginwithđ‘„_ = 1 + 𝑖tol1 = 1𝐾 − 4 OR (0.0001)tol2 = 1𝐾 − 4 OR (0.0001)

đ‘„_ = 1 + 𝑖, đ‘„< = 1 + 𝑖

𝑓(đ‘„_) = 2 + 5𝑖, 𝑓â€Č(đ‘„_) = 3 + 10𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5

𝑓â€Č đ‘„ = 3đ‘„; + 4đ‘„ − 1

Iteration1:đ‘„_ = 1 + 𝑖, đ‘„< = đ‘„_ −c 1bcx 1b

= 1 + 𝑖 − ;9~i79<_i

= 0.486238 + 1.04587𝑖

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 65: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = −2.9259, 0.46293 ± 1.22254𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5 = 0

Webeginwithđ‘„_ = 1 + 𝑖tol1 = 1𝐾 − 4 OR (0.0001)tol2 = 1𝐾 − 4 OR (0.0001)

Iteration2:đ‘„< = 0.486238 + 1.04587𝑖, đ‘„; = đ‘„< −c 18cx 18

=

= 0.486238 + 1.04587𝑖 −0.519354 − 0.402202𝑖−1.62730 + 7.23473𝑖

= 0.448139 + 1.23665𝑖

đ‘„_ = 1 + 𝑖, đ‘„< = 1 + 𝑖

𝑓(đ‘„_) = 2 + 5𝑖, 𝑓â€Č(đ‘„_) = 3 + 10𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5

𝑓â€Č đ‘„ = 3đ‘„; + 4đ‘„ − 1

Iteration1:đ‘„_ = 1 + 𝑖, đ‘„< = đ‘„_ −c 1bcx 1b

= 1 + 𝑖 − ;9~i79<_i

= 0.486238 + 1.04587𝑖

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 66: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = −2.9259, 0.46293 ± 1.22254𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5 = 0

Webeginwithđ‘„_ = 1 + 𝑖tol1 = 1𝐾 − 4 OR (0.0001)tol2 = 1𝐾 − 4 OR (0.0001)

Iteration2:đ‘„< = 0.486238 + 1.04587𝑖, đ‘„; = đ‘„< −c 18cx 18

=

= 0.486238 + 1.04587𝑖 −0.519354 − 0.402202𝑖−1.62730 + 7.23473𝑖

= 0.448139 + 1.23665𝑖

Iteration3:đ‘„; = 0.448139 + 1.23665𝑖, đ‘„7 = đ‘„; −c 1:cx 1:

=

= 0.448139 + 1.23665𝑖 −−0.0711105 − 0.166035𝑖−3.19287 + 8.27175𝑖

= 0.462720 + 1.22242𝑖

đ‘„_ = 1 + 𝑖, đ‘„< = 1 + 𝑖

𝑓(đ‘„_) = 2 + 5𝑖, 𝑓â€Č(đ‘„_) = 3 + 10𝑖

𝑓 đ‘„ = đ‘„7 + 2đ‘„; − đ‘„ + 5

𝑓â€Č đ‘„ = 3đ‘„; + 4đ‘„ − 1

Iteration1:đ‘„_ = 1 + 𝑖, đ‘„< = đ‘„_ −c 1bcx 1b

= 1 + 𝑖 − ;9~i79<_i

= 0.486238 + 1.04587𝑖

COMPUTE ! "# ,!â€Č("#)SET ") = "#IF ! "# ≠ 0 AND !â€Č "# ≠ 0 THEN

REPEATSET "# = ")SET ") = "# − .(/0)

.1(/0)UNTIL ( ") − "# <tol1)OR(|!("))| <tol2)

‱ "# reasonablyclose totheroot‱ tol1:thespecified tolerancevaluefordifference

betweensuccessivex-values.‱ tol2:thespecified tolerancevalueforhowclose!(")) tozero.

INPUT

Newton’sMethod

Page 67: CPE 310: Numerical Analysis for Engineers

http://mathfaculty.fullerton.edu/mathews/a2001/Animations/RootFinding/NewtonMethod/NewtonMethod.html

Newton’sMethod- Animation

Page 68: CPE 310: Numerical Analysis for Engineers

Fixed-PointIterationMethod

Page 69: CPE 310: Numerical Analysis for Engineers

Fixed-PointIterationMethod

A veryusefulwaytogetarootofagiven𝑓(đ‘„)

Werearrange𝑓(đ‘„) intoanequivalentformđ‘„ = 𝑔(đ‘„)

If𝑟 isarootof𝑓(đ‘„),then𝑓 𝑟 = 𝑟 − 𝑔 𝑟 = 0 âŸč 𝑟 = 𝑔(𝑟)

𝑓 đ‘„ = đ‘„; − 2đ‘„

𝑟 isafixed-pointforfunction𝑔

đ‘„ = 𝑔 đ‘„ = 2đ‘„ïżœ

đ‘„o9< = 𝑔 đ‘„o 𝑛 = 0,1,2,3, 


Page 70: CPE 310: Numerical Analysis for Engineers

Forgivenequation𝑓(đ‘„) = 0,theremaybemanyequivalentfixed-pointproblemsđ‘„ = 𝑔(đ‘„) withdifferentchoiceof𝑔(đ‘„)

𝑓 đ‘„ = đ‘„; − 2đ‘„ − 3 = 0

𝑔< đ‘„ = 2đ‘„ + 3ïżœ 𝑔; đ‘„ =3

đ‘„ − 2 𝑔7 đ‘„ =đ‘„; − 32

!" # = #% − 32

Page 71: CPE 310: Numerical Analysis for Engineers

REARRANGE 𝑓 đ‘„ INTO đ‘„ = 𝑔(đ‘„)SET đ‘„; = đ‘„<REPEAT

SET đ‘„< = đ‘„;SET đ‘„; = 𝑔(đ‘„<)UNTIL ( đ‘„< − đ‘„_ <tol)

‱ đ‘„< reasonablyclose totheroot‱ tol:thespecifiedtolerancevalueINPUT

Fixed-PointIterationMethod(đ‘„ = 𝑔(đ‘„)Method)

‱ Themethodmayconvergetoarootdifferentfromtheexpectedoneordiverge.‱ Differentrearrangementswillconvergeatdifferentrates.

NOTES

Page 72: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = −1, 3𝑓 đ‘„ = đ‘„; − 2đ‘„ − 3 = 0

Webeginwithđ‘„_ = 4tol = 1𝐾 − 4 OR (0.0001)

REARRANGE ! " INTO " = $(")SET "' = "(REPEAT

SET "( = "'SET "' = $("()UNTIL ( "( − "* <tol)

‱ "( reasonablyclose totheroot‱ tol:thespecified tolerancevalueINPUT

Fixed-PointIterationMethod(" = $(")Method)

𝑔< đ‘„ = 2đ‘„ + 3ïżœ

đ‘„_ = 4,đ‘„< = 2 4 + 3ïżœ = 11ïżœ = 3.31663đ‘„; = 2 3.31663 + 3ïżœ = 9.63325ïżœ = 3.10375đ‘„7 = 2 3.10375 + 3ïżœ = 9.20750ïżœ = 3.03439đ‘„} = 2 3.31663 + 3ïżœ = 9.06877ïżœ = 3.01144đ‘„~ = 2 3.01144 + 3ïżœ = 9.02288ïżœ = 3.00381đ‘„{ = 2 3.00381 + 3ïżœ = 9.00762ïżœ = 3.00127đ‘„ïżœ = 2 3.00127 + 3ïżœ = 9.00254ïżœ = 3.00042đ‘„| = 2 3.00042 + 3ïżœ = 9.00084ïżœ = 3.00013đ‘„ïżœ = 2 3.00013 + 3ïżœ = 9.00026ïżœ = 3.00004

đ‘„_ đ‘„o9< = 𝑔(đ‘„o)

Page 73: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = −1, 3𝑓 đ‘„ = đ‘„; − 2đ‘„ − 3 = 0

Webeginwithđ‘„_ = 4tol = 1𝐾 − 4 OR (0.0001)

REARRANGE ! " INTO " = $(")SET "' = "(REPEAT

SET "( = "'SET "' = $("()UNTIL ( "( − "* <tol)

‱ "( reasonablyclose totheroot‱ tol:thespecified tolerancevalueINPUT

Fixed-PointIterationMethod(" = $(")Method)

đ‘„_ = 4,đ‘„< = 1.5đ‘„; = −6đ‘„7 = −0.375đ‘„} = −1.263158đ‘„~ = −0.919355đ‘„{ = −1.02762đ‘„ïżœ = −0.990876đ‘„| = −1.00305

𝑔; đ‘„ =3

đ‘„ − 2

đ‘„_

Page 74: CPE 310: Numerical Analysis for Engineers

đ‘„CDEFGH = −1, 3𝑓 đ‘„ = đ‘„; − 2đ‘„ − 3 = 0

Webeginwithđ‘„_ = 4tol = 1𝐾 − 4 OR (0.0001)

REARRANGE ! " INTO " = $(")SET "' = "(REPEAT

SET "( = "'SET "' = $("()UNTIL ( "( − "* <tol)

‱ "( reasonablyclose totheroot‱ tol:thespecified tolerancevalueINPUT

Fixed-PointIterationMethod(" = $(")Method)

đ‘„_ = 4,đ‘„< = 6.5đ‘„; = 19.625đ‘„7 = 191.070

𝑔7 đ‘„ =đ‘„; − 32

Diverges

đ‘„_

𝑔7 đ‘„ =đ‘„; − 32

Page 75: CPE 310: Numerical Analysis for Engineers

Startonthex-axisattheinitialđ‘„_, goverticallytothecurve𝑔(đ‘„),thenhorizontallytotheline 𝑩 = đ‘„, thenverticallytothecurve,andagainhorizontallytotheline.

Repeatthisprocessuntilthepointsonthecurveconverge toafixedpointorelsediverge

Howitworks?

!" # = #% − 32

Page 76: CPE 310: Numerical Analysis for Engineers

Thedifferentbehaviorsdependonwhethertheslopeofthecurve isgreater,less,orofoppositesigntotheslopeoftheline

Howitworks?

DivergesConvergesConverges

!"

0<SlopeofCurve<1

monotonicconvergence

|SlopeofCurve|≄ 1-1<SlopeofCurve<0

oscillatoryconvergence

!"

#$ ! = !& − 32

!"

Page 77: CPE 310: Numerical Analysis for Engineers

http://mathfaculty.fullerton.edu/mathews/a2001/Animations/RootFinding/FixedPoint/FixedPoint.html

Fixed-PointIteration- Animation