Docsity

Numerical Methods: Bisection, Newton-Raphson & Interpolation – Study Notes, Summaries of Mathematics

Toggle sidebar
bg1
Numerical Methods: Bisection, Newton-Raphson & Interpolation – Study Notes Page 1 of 5
Numerical Methods: Bisection, Newton-Raphson & Interpolation – Study Notes
High School & College Mathematics · Page 1 of 5: Introduction to Numerical Methods
1.1 What are Numerical Methods, and why do we need them?
Definition. Numerical methods are step-by-step procedures that find approximate answers to mathematical problems using only simple
arithmetic (+, −, ×, ÷). We start with a guess (or some data) and improve it until the answer is accurate enough.
Why are they useful?
•Many equations have no algebra formula, e.g. cos x = x or x3 − x
− 2 = 0.
•Real data are measured at separate points; values in between
must be estimated.
•Calculators and computers use them inside (for √, sin, log, …).
•Science and engineering need an answer that is good enough,
with a known error size.
Exact vs approximate solutions
An exact solution is the perfect value: x2=4 gives x=2; or we keep the
symbol √2. An approximate solution is a number close to the true
value: √2 ≈ 1.4142 (the true decimal 1.41421356… never ends). A
numerical method gives an approximate answer whose error we can
measure and shrink.
1.2 Errors in numerical calculations
Absolute error Relative error Percentage error
size of the mistake mistake compared with the true size relative error as a percent
When the true value is unknown (typical for iterations), estimate the error by the change between two successive approximations: Ea ≈ |xn+1 −
xn|. Smaller error ⇒ better answer; relative and percentage errors let us compare values of different sizes.
Error comparison table — more digits kept ⇒ smaller error
Approximation of √2 =
1.41421356…
Significant
figures Absolute error EaRelative error ErPercentage error E%
1.4 2 0.0142136 0.0100505 1.00505%
1.41 3 0.0042136 0.0029794 0.29794%
1.414 4 0.0002136 0.0001510 0.01510%
1.4142 5 0.0000136 0.0000096 0.00096%
1.3 Convergence, stopping criteria and solving equations
Convergence. An iterative method converges when the
approximations x0, x1, x2,… get closer and closer to the true root.
Stopping criteria tell us when to stop:
•|xn+1 − xn| < ε (successive values agree);
•|f(xn)| < ε (the equation is almost satisfied);
•a maximum number of iterations is reached (safety stop).
Here ε (epsilon) is the tolerance; ε = 0.001 means about 3 correct
decimal places.
Solving equations numerically. To solve f(x)=0 we look for a root r
with f(r)=0. Move every term to one side, locate the root (graph, table of
values, sign change of f), pick a method and a starting value, iterate,
and stop when the error is below the tolerance. The methods in these
notes: Bisection (page 2), Newton-Raphson and Secant (page 3); then
Interpolation (page 4) for estimating values from data.
Figure 1 — Flow of a numerical solution process (the loop repeats until the error test is passed).
Example 1 — Errors in approximating π by 3.14
Ea = |3.14159265 − 3.14| = 0.00159265 ≈ 0.0016
Er = 0.00159265 ÷ 3.14159265 ≈ 0.000507
E% = 0.000507 × 100 ≈ 0.0507% → about 0.05% error (very small).
Example 2 — Same absolute error, different accuracy
True 50 cm, measured 49.8 cm; true 10 cm, measured 9.8 cm. Both
have Ea = 0.2 cm.
Rod: Er = 0.2 ÷ 50 = 0.004 → 0.4%. Pin: Er = 0.2 ÷ 10 = 0.02 → 2%.
The rod measurement is more accurate (smaller relative error).
Example 3 — Stopping criterion: xn+1 = 1 + 1/xn with x0=1 (solves x2 = x + 1); stop when |xn−xn−1| < 0.01
n0 1 2 3 4 5 6
xn1.0000 2.0000 1.5000 1.6667 1.6000 1.6250 1.6154
|xn − xn−1| – 1.0000 0.5000 0.1667 0.0667 0.0250 0.0096
The change first drops below 0.01 at n=6 (0.0096 < 0.01), so we stop: x ≈ 1.6154. (True root (1+√5)/2 = 1.6180, so the error is only about
0.0026.)
pf3
pf4
pf5

Partial preview of the text

Download Numerical Methods: Bisection, Newton-Raphson & Interpolation – Study Notes and more Summaries Mathematics in PDF only on Docsity!

Numerical Methods: Bisection, Newton-Raphson & Interpolation – Study Notes

High School & College Mathematics · Page 1 of 5: Introduction to Numerical Methods

1.1 What are Numerical Methods, and why do we need them?

Definition. Numerical methods are step-by-step procedures that find approximate answers to mathematical problems using only simple arithmetic (+, −, ×, ÷). We start with a guess (or some data) and improve it until the answer is accurate enough.

Why are they useful?

- Many equations have no algebra formula , e.g. cos x = x or x^3 − x − 2 = 0. - Real data are measured at separate points ; values in between must be estimated. - Calculators and computers use them inside (for √, sin, log, …). - Science and engineering need an answer that is good enough , with a known error size.

Exact vs approximate solutions An exact solution is the perfect value: x^2 =4 gives x =2; or we keep the symbol √2. An approximate solution is a number close to the true value: √2 ≈ 1.4142 (the true decimal 1.41421356… never ends). A numerical method gives an approximate answer whose error we can measure and shrink.

1.2 Errors in numerical calculations

Absolute error Relative error Percentage error

size of the mistake mistake compared with the true size relative error as a percent

When the true value is unknown (typical for iterations), estimate the error by the change between two successive approximations: Ea ≈ | xn +1 − xn |. Smaller error ⇒ better answer; relative and percentage errors let us compare values of different sizes.

Error comparison table — more digits kept ⇒ smaller error

Approximation of √2 = 1.41421356…

Significant figures Absolute error^ Ea^ Relative error^ Er^ Percentage error^ E % 1.4 2 0.0142136 0.0100505 1.00505% 1.41 3 0.0042136 0.0029794 0.29794% 1.414 4 0.0002136 0.0001510 0.01510% 1.4142 5 0.0000136 0.0000096 0.00096%

1.3 Convergence, stopping criteria and solving equations

Convergence. An iterative method converges when the approximations x 0 , x 1 , x 2 ,… get closer and closer to the true root. Stopping criteria tell us when to stop:

- | xn +1 − xn | < ε (successive values agree); - | f ( xn )| < ε (the equation is almost satisfied); - a maximum number of iterations is reached (safety stop). Here ε (epsilon) is the tolerance ; ε = 0.001 means about 3 correct decimal places.

Solving equations numerically. To solve f ( x )=0 we look for a root r with f ( r )=0. Move every term to one side, locate the root (graph, table of values, sign change of f ), pick a method and a starting value, iterate , and stop when the error is below the tolerance. The methods in these notes: Bisection (page 2), Newton-Raphson and Secant (page 3); then Interpolation (page 4) for estimating values from data.

Figure 1 — Flow of a numerical solution process (the loop repeats until the error test is passed).

Example 1 — Errors in approximating π by 3. Ea = |3.14159265 − 3.14| = 0.00159265 ≈ 0. Er = 0.00159265 ÷ 3.14159265 ≈ 0. E % = 0.000507 × 100 ≈ 0.0507% → about 0.05% error (very small).

Example 2 — Same absolute error, different accuracy True 50 cm, measured 49.8 cm; true 10 cm, measured 9.8 cm. Both have Ea = 0.2 cm. Rod: Er = 0.2 ÷ 50 = 0.004 → 0.4%. Pin: Er = 0.2 ÷ 10 = 0.02 → 2%. The rod measurement is more accurate (smaller relative error).

Example 3 — Stopping criterion: xn +1 = 1 + 1/ xn with x 0 =1 (solves x^2 = x + 1); stop when | xn − xn −1| < 0. n 0 1 2 3 4 5 6 xn 1.0000 2.0000 1.5000 1.6667 1.6000 1.6250 1. | xn − xn −1| – 1.0000 0.5000 0.1667 0.0667 0.0250 0. The change first drops below 0.01 at n =6 (0.0096 < 0.01), so we stop: x ≈ 1.6154. (True root (1+√5)/2 = 1.6180, so the error is only about 0.0026.)

PAGE 2 · The Bisection Method

Reliable root finding by repeatedly halving an interval

2.1 Idea, Intermediate Value Theorem and conditions

Bisection Method. To solve f ( x )=0, take an interval [ a , b ] that contains a root, cut it in half at the midpoint m , and keep the half in which f changes sign. Repeat: the interval shrinks by half each time and traps the root.

Intermediate Value idea. If f is continuous on [ a , b ] and f ( a ), f ( b ) have opposite signs ( f ( a )· f ( b ) < 0), the graph must cross the x-axis between a and b — a continuous curve cannot go from below the axis to above it without crossing. So at least one root c with a < c < b exists.

Conditions for using Bisection

1. f is continuous on [ a , b ] (no jumps or gaps). 2. f ( a )· f ( b ) < 0 (a sign change). 3. A tolerance ε (required accuracy) is chosen. If f ( a )· f ( b ) > 0 there is no guarantee — the interval may still hold an even number of roots, or none.

2.2 Step-by-step algorithm

1. Choose an interval [ a , b ] that you believe contains a root. 2. Check the signs of f ( a ) and f ( b ); they must differ, f ( a )· f ( b ) < 0. 3. Find the midpoint m = ( a + b )/2. 4. Evaluate f ( m ). If f ( m ) = 0 (or is tiny), m is the root. 5. Select the new interval: if f ( a )· f ( m ) < 0 the root lies in [ a , m ], so set b = m ; otherwise it lies in [ m , b ], so set a = m. 6. Repeat steps 3–5 until the required accuracy is reached, i.e. ( b − a )/2 < ε (or | f ( m )| < ε). Midpoint Error bound after n steps

How many steps? The interval width after n steps is ( b − a )/2 n , so to reach tolerance ε we need

Figure 2 — Interval halving for f(x)=x^3 −x−2 on [1, 2].

Advantages Limitations Always converges when the conditions hold; error bound known in advance Slow: the error only halves each step (≈ 3.3 steps per decimal digit)

Simple: needs only values of f , no derivative; works for any continuous f Needs a starting interval with a sign change; cannot find a root where thegraph only touches the axis (e.g. x (^2) =0)

2.3 Worked examples 4–

Example 4 — Can we use Bisection on f ( x )= x^3 − x −2? Try [0,1]: f (0) = −2, f (1) = −2 → same sign, so no guarantee. Try [1,2]: f (1) = 1−1−2 = −2, f (2) = 8−2−2 = 4 → opposite signs and f is a polynomial (continuous), so a root exists in (1, 2). ✓

Example 5 — Eight bisection steps for x^3 − x −2=0 on [1, 2]

n a b m =( a 2 + b )/ f ( m ) Sign Keep (new interval)

1 1.000000 2.000000 1.500000 −0.125000 − [1.5, 2] 2 1.500000 2.000000 1.750000 1.609375 + [1.5, 1.75] 3 1.500000 1.750000 1.625000 0.666016 + [1.5, 1.625] 4 1.500000 1.625000 1.562500 0.252197 + [1.5, 1.5625] 5 1.500000 1.562500 1.531250 0.059113 + [1.5, 1.53125] 6 1.500000 1.531250 1.515625 −0.034054 − [1.515625, 1.53125] 7 1.515625 1.531250 1.523438 0.012250 + [1.515625, 1.523438] 8 1.515625 1.523438 1.519531 −0.010971 − [1.519531, 1.523438] After 8 steps the root lies in [1.519531, 1.523438]. Its midpoint 1.521484 gives x ≈ 1.5215 with error ≤ 0.00195. (True root 1.521380, so the actual error is ≈ 0.0001.)

Example 6 — Steps needed for accuracy 0. on [1, 2] n ≥ log 2 ((2−1)/0.001) = log 2 (1000) = ln 1000 ÷ ln 2 ≈ 9. So n = 10 steps. Check: 1/2^10 = 0.000977 < 0.001 ✓

Example 7 — Solve cos x = x on [0, 1] (radians) Let g ( x ) = cos x − x. g (0) = 1 > 0 and g (1) = −0.4597 < 0 → sign change ✓ n m g ( m ) New interval 1 0.50000 +0.3776 [0.5, 1] 2 0.75000 −0.0183 [0.5, 0.75] 3 0.62500 +0.1860 [0.625, 0.75] 4 0.68750 +0.0853 [0.6875, 0.75] 5 0.71875 +0.0339 [0.71875, 0.75] The root lies in [0.71875, 0.75], so x ≈ 0. (±0.016). True root: 0.7391 ✓

Exam tip. Always show the signs of f ( a ) and f ( b ) first, then a neat table with columns n , a , b , m , f ( m ). Keep 6 decimals while calculating; round only at the end.

PAGE 4 · Interpolation & Applications

Estimating unknown values from known data points

4.1 What is interpolation?

Interpolation means estimating an unknown value between known data points, by assuming a smooth pattern joins them. Given points ( x 0 , y 0 ), ( x 1 , y 1 ), … we build a simple function (a line or a polynomial) that passes through them, then read off its value at the new x.

To estimate an unknown value:

1. List the known data points (a table of x and y ). 2. Check that the new x lies between the smallest and largest known x. 3. Choose a method: 2 nearby points → linear; 3 or more points → Lagrange. 4. Substitute and calculate; check the answer looks sensible.

Feature Interpolation Extrapolation Where is the new x? Inside the data range^ Outside the data range Reliability Usually good Riskier: error can grow fast

Example (^) from 10:00 and 12:00 dataTemperature at 11:30^ Temperature at 13:00from the same data

4.2 Linear and Lagrange interpolation

Linear interpolation (straight line through 2 points)

The fraction t = ( x − x 0 )/( x 1 − x 0 ) is the proportion of the way from x 0 to x 1 (0 < t < 1 for interpolation). So y = y 0 + t ( y 1 − y 0 ), and y lies between y 0 and y 1.

Lagrange interpolation (curve through 3 points)

L 1 and L 2 follow the same pattern: leave xi out of the numerator and use xi − xj in the denominator. Each Li equals 1 at xi and 0 at the other data points, so P ( x ) passes through every point; L 0 + L 1 + L 2 =1 is a handy check. With only two points, Lagrange gives the linear formula.

Figure 4 — Left: linear interpolation (solid) versus extrapolation (dashed). Right: Lagrange curve through three points.

4.3 Applications and method-selection guide

Science Estimate temperature, pressure or concentration between lab measurements.

Engineering Read values between table entries (material or steam tables); smooth sensor data.

Finance Estimate the interest rate or bond yield for a maturity that is not quoted.

Data analysis Fill in missing values of a time series; resample data at new points.

Situation Best method Reason Solve f ( x )=0; you only know an interval with a sign change Bisection Guaranteed, simple, no derivative f '( x ) is easy; you have a good starting guess; speed matters Newton-Raphson Very fast convergence f '( x ) is difficult or unavailable Secant Fast, derivative-free Estimate a value between 2 data points Linear interpolation Simple straight-line estimate Estimate between 3 or more points on a curved pattern Lagrange interpolation One smooth curve through all points Need a value outside the data range Extrapolate with care Less reliable – state the risk, or collect more data

4.4 Worked examples 12–

Example 12 — Linear interpolation: temperature At 10:00 the temperature is 20 °C; at 12:00 it is 26 °C. Estimate it at 11:30. x 0 =10, y 0 =20, x 1 =12, y 1 =26, x =11. y = 20 + (11.5−10)/(12−10) × (26−20) = 20 + 0.75 × 6 = 24.5 °C

Example 14 — Lagrange: data (1, 3), (2, 7), (4, 21); find y at x = L 0 = (3−2)(3−4)/[(1−2)(1−4)] = (1)(−1)/(3) = −1/ L 1 = (3−1)(3−4)/[(2−1)(2−4)] = (2)(−1)/(−2) = 1 L 2 = (3−1)(3−2)/[(4−1)(4−2)] = 2/6 = 1/3 (sum = 1 ✓) P (3) = 3(−1/3) + 7(1) + 21(1/3) = −1 + 7 + 7 = 13

Example 13 — Estimate √20 from √16 = 4 and √25 = 5 y = 4 + (20−16)/(25−16) × (5−4) = 4 + 4/9 ≈ 4. True √20 = 4.4721. Ea = 0.0277, Er = 0.00619, E % = 0.619%. (A straight line under-estimates a concave curve.)

Example 15 — Finance: bond yield curve The 2-year yield is 3.0% and the 5-year yield is 4.2%. Estimate the 3-year yield. y = 3.0 + (3−2)/(5−2) × (4.2−3.0) = 3.0 + 0.4 = 3.4% (interpolation) Using the same line for 6 years gives 4.6% — that is extrapolation , so treat it with caution.

PAGE 5 · Formula Sheet, Exam Tips & Quick Revision

Everything you need to revise in one page

5.1 Formula sheet

Absolute error Relative error

Percentage error Linearinterpolation

Newton- Raphson Secant

Bisection steps

① choose [ a , b ] ② check f ( a ) f ( b ) < 0 ③ m =( a + b )/2 ④ find f ( m ) ⑤ keep the half with a sign change ⑥ repeat until ( b − a )/2 < ε. Steps needed: n ≥ log 2 (( b − a )/ε).

Lagrange (basic)

5.2 Methods at a glance

Method Purpose Needs Speed Watch out for Bisection Root of f ( x )=0 Interval with sign change Slow, always works Needs f ( a ) f ( b ) < 0 Newton-Raphson Root of f ( x )=0 f '( x ) and a good x 0 Very fast f '( xn ) = 0; bad x 0 Secant Root of f ( x )=0 Two starting values Fast Equal f values; bad guesses Linear interpolation Value between 2 points Two data points Instant Curved data → small error Lagrange interpolation Value between 3+ points Three or more data points Instant Wild swings with many points

Common student mistakes ✗ Using degrees instead of radians for cos x , sin x equations. ✗ Starting Bisection without checking f ( a ) f ( b ) < 0. ✗ Keeping the wrong half-interval (sign mix-up). ✗ Rounding too early; keep 6 decimals, round at the end. ✗ Newton: poor x 0 or f '( x 0 ) = 0. ✗ Forgetting ×100 for percentage error, or dividing by the approximation instead of the true value. ✗ Trusting extrapolation as much as interpolation.

Exam tips ✓ Write the formula first, then substitute, then calculate. ✓ Always tabulate iterations: n , xn , f ( xn ), error. ✓ State the stopping rule and the final answer to the required decimals. ✓ For “how many steps” questions use n ≥ log 2 (( b − a )/ε) and round up. ✓ Check by substituting your answer: f ( x ) ≈ 0. ✓ A quick sketch shows where the root or the data lie. ✓ Lagrange check: the Li must add up to 1.

5.3 Problem-solving checklist and practice

Checklist:

1. Read the question: root, estimate, or error? 2. Write f ( x ) = 0 or list the data points. 3. Pick a method and verify its conditions (sign change, f ' ≠ 0, x inside data range). 4. Set up a table; calculate with extra decimals. 5. Apply the stopping rule or the step formula. 6. Check the answer and state it with units and accuracy.

Practice 1. A true value is 8.00 and its approximation is 7.92. Find the absolute, relative and percentage errors.

Practice 2. Show that f ( x )= x^3 −2 x −5 has a root in [2, 3]. Do the first bisection step and state the new interval.

Practice 3. Newton-Raphson for f ( x )= x^2 −10, x 0 =3: find x 1 and x 2 ( d.p.).

Practice 4. Secant Method for f ( x )= x^2 −2 with x 0 =1, x 1 =2: find x 2 ( d.p.). Practice 5. A graph passes through (2, 10) and (6, 22). Use linear interpolation to estimate y at x =5. Practice 6. Use Lagrange interpolation through (0, 1), (1, 2), (2, 5) to estimate y at x =1.5.

Answer key. 1: Ea =0.08, Er =0.01, E %=1%. 2: f (2)=−1, f (3)=16 → root exists; m =2.5, f (2.5)=5.625 > 0 → new interval [2, 2.5]. 3: f '=2 x ; x 1 =3.1667, x 2 =3.1623. 4: x 2 =2−2(1)/3=1.3333. 5: y =10+(3/4)(12)=19. 6: L 0 =−0.125, L 1 =0.75, L 2 =0.375 → P (1.5)=3.25.

QUICK REVISION SUMMARY

★ Numerical methods give approximate answers with a measurable error : Ea , Er , E %. Iterate until | xn +1− xn | < ε. ★ Bisection: needs f ( a ) f ( b ) < 0; halves the interval every step; slow but sure. ★ Newton-Raphson: xn +1= xn − f / f '; very fast with a good x 0 and f ' ≠ 0. Secant: Newton with a slope from two points; no derivative. ★ Interpolation estimates inside the data range (linear: 2 points; Lagrange: 3+ points); extrapolation goes outside and is riskier. ★ Always: check the method's conditions first, tabulate every step, keep extra decimals, and finish by checking f ( x ) ≈ 0 or that y lies between the neighbouring values.