Nonlinear Equations = 40 / How can we solve these equations? - - PowerPoint PPT Presentation

โ–ถ
nonlinear equations
SMART_READER_LITE
LIVE PREVIEW

Nonlinear Equations = 40 / How can we solve these equations? - - PowerPoint PPT Presentation

Nonlinear Equations = 40 / How can we solve these equations? Spring force: = ! = 0.5 / What is the displacement when = 2N? Drag force: = 0.5 ! " = !


slide-1
SLIDE 1

Nonlinear Equations

slide-2
SLIDE 2

How can we solve these equations?

  • Spring force:

๐บ = ๐‘™ ๐‘ฆ What is the displacement when ๐บ = 2N?

  • Drag force:

๐บ = 0.5 ๐ท! ๐œ ๐ต ๐‘ค" = ๐œˆ! ๐‘ค" What is the velocity when ๐บ = 20N?

๐‘™ = 40 ๐‘‚/๐‘› ๐œˆ! = 0.5 ๐‘‚๐‘ก/๐‘›

slide-3
SLIDE 3
  • Spring force:

๐‘” ๐‘ฆ = ๐‘™ ๐‘ฆ โˆ’ ๐บ = 0

  • Drag force:

๐‘” ๐‘ค = ๐œˆ! ๐‘ค" โˆ’๐บ = 0

๐œˆ! = 0.5 ๐‘‚๐‘ก/๐‘›

Nonlinear Equations in 1D

Goal: Solve ๐‘” ๐‘ฆ = 0 for ๐‘”: โ„› โ†’ โ„› Find the root (zero) of the nonlinear equation ๐‘” ๐‘ค Often called Root Finding

slide-4
SLIDE 4

Bisection method

Algorithm: 1.Take two points, ๐‘ and ๐‘, on each side of the root such that ๐‘”(๐‘) and ๐‘”(๐‘) have

  • pposite signs.

2.Calculate the midpoint ๐‘› = !"#

$

  • 3. Evaluate ๐‘”(๐‘›) and use ๐‘› to replace either ๐‘ or ๐‘, keeping the signs of the

endpoints opposite.

slide-5
SLIDE 5

Convergence

  • The bisection method does not estimate ๐‘ฆ., the approximation of the

desired root ๐‘ฆ. It instead finds an interval smaller than a given tolerance that contains the root.

  • The length of the interval at iteration ๐‘™ is /01

"! . We can define this

interval as the error at iteration ๐‘™

lim

"โ†’$

|๐‘“"%&| |๐‘“"| = lim

"โ†’$

|๐‘“"%&| |๐‘“"| = lim

"โ†’$

๐‘ โˆ’ ๐‘ 2"%& ๐‘ โˆ’ ๐‘ 2" = 0.5

  • Linear convergence
slide-6
SLIDE 6

Convergence

An iterative method converges with rate ๐‘  if: lim

.โ†’<

||๐‘“.=>|| ||๐‘“.||? = ๐ท, 0 < ๐ท < โˆž ๐‘  = 1: linear convergence ๐‘  > 1: superlinear convergence ๐‘  = 2: quadratic convergence Linear convergence gains a constant number of accurate digits each step (and ๐ท < 1 matters! Quadratic convergence doubles the number of accurate digits in each step (however it only starts making sense once ||๐‘“.|| is small (and ๐ท does not matter much)

slide-7
SLIDE 7

Example:

Consider the nonlinear equation ๐‘” ๐‘ฆ = 0.5๐‘ฆ" โˆ’ 2 and solving f x = 0 using the Bisection Method. For each of the initial intervals below, how many iterations are required to ensure the root is accurate within 20@? A) [โˆ’10, โˆ’1.8] B) [โˆ’3, โˆ’2.1] C) [โˆ’4, 1.9]

slide-8
SLIDE 8

Bisection Method - summary

q The function must be continuous with a root in the interval ๐‘, ๐‘ q Requires only one function evaluations for each iteration!

  • The first iteration requires two function evaluations.

q Given the initial internal [๐‘, ๐‘], the length of the interval after ๐‘™ iterations is /01

"!

q Has linear convergence

slide-9
SLIDE 9

Newtonโ€™s method

  • Recall we want to solve ๐‘” ๐‘ฆ = 0 for ๐‘”: โ„› โ†’ โ„›
  • The Taylor expansion:

๐‘” ๐‘ฆ. + โ„Ž โ‰ˆ ๐‘” ๐‘ฆ. + ๐‘”โ€ฒ ๐‘ฆ. โ„Ž gives a linear approximation for the nonlinear function ๐‘” near ๐‘ฆ.. ๐‘” ๐‘ฆ. + โ„Ž = 0 โ†’ โ„Ž = โˆ’๐‘” ๐‘ฆ. /๐‘”โ€ฒ ๐‘ฆ.

  • Algorithm:

๐‘ฆ.=> = ๐‘ฆ. โˆ’ ๐‘” ๐‘ฆ. /๐‘”โ€ฒ ๐‘ฆ. ๐‘ฆA = ๐‘ก๐‘ข๐‘๐‘ ๐‘ข๐‘—๐‘œ๐‘• ๐‘•๐‘ฃ๐‘“๐‘ก๐‘ก

slide-10
SLIDE 10

Newtonโ€™s method

Equation of the tangent line: ๐‘”โ€ฒ(๐‘ฆ.) = ๐‘” ๐‘ฆ. โˆ’ 0 ๐‘ฆ. โˆ’ ๐‘ฆ.=>

๐‘ฆ"%& ๐‘ฆ"

slide-11
SLIDE 11

Iclicker question

Consider solving the nonlinear equation 5 = 2.0 ๐‘“C + ๐‘ฆ" What is the result of applying one iteration of Newtonโ€™s method for solving nonlinear equations with initial starting guess ๐‘ฆA = 0, i.e. what is ๐‘ฆ>? A) โˆ’2 B) 0.75 C) โˆ’1.5 D) 1.5 E) 3.0

slide-12
SLIDE 12

Newtonโ€™s Method - summary

q Must be started with initial guess close enough to root (convergence is

  • nly local). Otherwise it may not converge at all.

q Requires function and first derivative evaluation at each iteration (think about two function evaluations) q What can we do when the derivative evaluation is too costly (or difficult to evaluate)? q Typically has quadratic convergence lim

.โ†’<

||๐‘“.=>|| ||๐‘“.||" = ๐ท, 0 < ๐ท < โˆž

slide-13
SLIDE 13

Secant method

Also derived from Taylor expansion, but instead of using ๐‘”โ€ฒ ๐‘ฆ. , it approximates the tangent with the secant line: Secant line: ๐‘”โ€ฒ(๐‘ฆ.) โ‰ˆ ๐‘” ๐‘ฆ. โˆ’ ๐‘” ๐‘ฆ.0> ๐‘ฆ. โˆ’ ๐‘ฆ.0>

๐‘ฆ"%& ๐‘ฆ"'& ๐‘ฆ"

๐‘ฆ.=> = ๐‘ฆ. โˆ’ ๐‘” ๐‘ฆ. /๐‘”โ€ฒ ๐‘ฆ.

  • Algorithm:

๐‘ฆ!, ๐‘ฆ" = ๐‘ก๐‘ข๐‘๐‘ ๐‘ข๐‘—๐‘œ๐‘• ๐‘•๐‘ฃ๐‘“๐‘ก๐‘ก๐‘“๐‘ก ๐‘”# ๐‘ฆ$ = ๐‘” ๐‘ฆ$ โˆ’ ๐‘” ๐‘ฆ$%" ๐‘ฆ$ โˆ’ ๐‘ฆ$%" ๐‘ฆ$&" = ๐‘ฆ$ โˆ’ ๐‘” ๐‘ฆ$ /๐‘”โ€ฒ ๐‘ฆ$

slide-14
SLIDE 14

Secant Method - summary

q Still local convergence q Requires only one function evaluation per iteration (only the first iteration requires two function evaluations) q Needs two starting guesses q Has slower convergence than Newtonโ€™s Method โ€“ superlinear convergence lim

.โ†’<

||๐‘“.=>|| ||๐‘“.||? = ๐ท, 1 < ๐‘  < 2

slide-15
SLIDE 15

1D methods for root finding:

Method Update Convergence Cost Bisection Check signs of ๐‘” ๐‘ and ๐‘” ๐‘ ๐‘ข! = |๐‘ โˆ’ ๐‘| 2! Linear (๐‘  = 1 and c = 0.5) One function evaluation per iteration, no need to compute derivatives Secant ๐‘ฆ!"# = ๐‘ฆ! + โ„Ž โ„Ž = โˆ’๐‘” ๐‘ฆ! /๐‘’๐‘”๐‘ ๐‘’๐‘”๐‘ = ๐‘” ๐‘ฆ! โˆ’ ๐‘” ๐‘ฆ!$# ๐‘ฆ! โˆ’ ๐‘ฆ!$# Superlinear ๐‘  = 1.618 , local convergence properties, convergence depends on the initial guess One function evaluation per iteration (two evaluations for the initial guesses only), no need to compute derivatives Newton ๐‘ฆ!"# = ๐‘ฆ! + โ„Ž โ„Ž = โˆ’๐‘” ๐‘ฆ! /๐‘”โ€ฒ ๐‘ฆ! Quadratic ๐‘  = 2 , local convergence properties, convergence depends on the initial guess Two function evaluations per iteration, requires first order derivatives

slide-16
SLIDE 16

Nonlinear system of equations

slide-17
SLIDE 17

https://www.youtube.com/watch?v=NRgNDlVtmz0 (Robotic arm 1) https://www.youtube.com/watch?v=9DqRkLQ5Sv8 (Robotic arm 2) https://www.youtube.com/watch?v=DZ_ocmY8xEI (Blender)

Robotic arms

slide-18
SLIDE 18

Nonlinear system of equations

Goal: Solve ๐’ˆ ๐’š = ๐Ÿ for ๐’ˆ: โ„›D โ†’ โ„›D In other words, ๐’ˆ ๐’š is a vector-valued function ๐’ˆ ๐’š = ๐‘”

> ๐’š

โ‹ฎ ๐‘”

D ๐’š

= ๐‘”

> ๐‘ฆ>, ๐‘ฆ", ๐‘ฆE, โ€ฆ , ๐‘ฆD

โ‹ฎ ๐‘”

D ๐‘ฆ>, ๐‘ฆ", ๐‘ฆE, โ€ฆ , ๐‘ฆD

If looking for a solution to ๐’ˆ ๐’š = ๐’›, then instead solve ๐’ˆ ๐’š = ๐’ˆ ๐’š โˆ’ ๐’› = ๐Ÿ

slide-19
SLIDE 19

Newtonโ€™s method

Approximate the nonlinear function ๐’ˆ ๐’š by a linear function using Taylor expansion: ๐’ˆ ๐’š + ๐’• โ‰ˆ ๐’ˆ ๐’š + ๐‘ฒ ๐’š ๐’• where ๐‘ฒ ๐’š is the Jacobian matrix of the function ๐’ˆ: ๐‘ฒ ๐’š =

FG

" ๐’š

FC"

โ€ฆ

FG

" ๐’š

FC#

โ‹ฎ โ‹ฑ โ‹ฎ

FG

# ๐’š

FC"

โ€ฆ

FG

# ๐’š

FC#

  • r ๐‘ฒ ๐’š

IJ = FG$ ๐’š FC%

Set ๐’ˆ ๐’š + ๐’• = ๐Ÿ โŸน ๐‘ฒ ๐’š ๐’• = โˆ’๐’ˆ ๐’š This is a linear system of equations (solve for ๐’•)!

slide-20
SLIDE 20

Newtonโ€™s method

Algorithm: ๐’šA = ๐‘—๐‘œ๐‘—๐‘ข๐‘—๐‘๐‘š ๐‘•๐‘ฃ๐‘“๐‘ก๐‘ก Solve ๐‘ฒ ๐’š. ๐’•. = โˆ’๐’ˆ ๐’š. Update ๐’š.=> = ๐’š. + ๐’•. Convergence:

  • Typically has quadratic convergence
  • Drawback: Still only locally convergent

Cost:

  • Main cost associated with computing the Jacobian matrix and solving

the Newton step.

slide-21
SLIDE 21

Newtonโ€™s method - summary

q Typically quadratic convergence (local convergence) q Computing the Jacobian matrix requires the equivalent of ๐‘œ" function evaluations for a dense problem (where every function of ๐’ˆ ๐’š depends

  • n every component of ๐’š).

q Computation of the Jacobian may be cheaper if the matrix is sparse. q The cost of calculating the step ๐’• is ๐‘ƒ ๐‘œE for a dense Jacobian matrix (Factorization + Solve) q If the same Jacobian matrix ๐‘ฒ ๐’š. is reused for several consecutive iterations, the convergence rate will suffer accordingly (trade-off between cost per iteration and number of iterations needed for convergence)

slide-22
SLIDE 22

Example

Consider solving the nonlinear system of equations 2 = 2๐‘ง + ๐‘ฆ 4 = ๐‘ฆ" + 4๐‘ง" What is the result of applying one iteration of Newtonโ€™s method with the following initial guess? ๐’šA = 1

slide-23
SLIDE 23

Finite Difference

Find an approximate for the Jacobian matrix:

๐‘ฒ ๐’š =

%&

% ๐’š

%(%

โ€ฆ

%&

% ๐’š

%(&

โ‹ฎ โ‹ฑ โ‹ฎ

%&

& ๐’š

%(%

โ€ฆ

%&

& ๐’š

%(&

  • r ๐‘ฒ ๐’š

)* = %&' ๐’š %((

๐œ–๐‘” ๐‘ฆ ๐œ–๐‘ฆ โ‰ˆ ๐‘” ๐‘ฆ + โ„Ž โˆ’ ๐‘” ๐‘ฆ โ„Ž

In 1D: In ND:

๐‘ฒ ๐’š

IJ = FG$ ๐’š FC% โ‰ˆ G$ ๐’š=K ๐œบ% 0G$ ๐’š K