Handout - 20 Numerical Methods ALL
Handout - 20 Numerical Methods ALL
Use your calculator to draw the graph of y = x5 – 5x + 3, use values of x from -3 to +3 and values of y from
-2 to + 8. (Alter the axes using V-window) Sketch the graph below.
C) Complete the table below to show values of x and y for the equation y = x5 – 5x + 3
1
Handout 20 – Numerical Methods
D) Can we be more accurate?
• Zoom in on this solution on your calculator, by altering the x axis (use V-Window) to min 0, max 1.
• Sketch the graph below, and complete the table, again you may wish to use the table function.
x y
0
0.1
0.2
0.3
0.4
0.5
1 0.6
0.7
0.8
0.9
The function is __________________ in __________________ 1.0
• Write down a new interval for the root, of width 0.1
Repeat the above procedure until you can write down the root to 2 decimal places.
x y Write down a new x y Write down a new interval for
interval for the root, of the root, of width 0.001.
width 0.01. _________________________
So, the root is _____________
to 2 decimal places.
2
Handout 20 – Numerical Methods
If we select x-values and find f(x), we should be able to
pick x-values so that f(x) heads towards zero.
E.g. x = 1, 1 – 2 sin (1) = –0·68 (negative)
x = 2, 2 – 2 sin (2) = 0·18 (positive)
From 1 to 2, f(x) passes from negative (through zero) to
positive. Because the function is continuous (no breaks
in it), then f(x) must have passed through zero in the
interval (1, 2).
The change in sign of f(x) indicates the location of the
root.
Decimal Search: Knowing the interval in which the root lies, we can use decimal search to find the root to
a greater degree of accuracy.
Exercise 1: Find to 2 decimal places, the root located in the interval (2, 3) to the equation x3 – 3x2 + 2 = 0.
3
Handout 20 – Numerical Methods
Exercises: Ex. 17.1 A q.1 ad, 3b, 7 ac
4
Handout 20 – Numerical Methods
ITERATION
We can solve equations by drawing graphs and finding where they cross.
Show that the equation x5 – 5x +3 = 0 𝑥 5 +3
Sketch the graphs of 𝑦 = 5 and y = x, clearly showing
x5 + 3
can be rearranged as x = all points of intersection of the two lines
5
𝑥𝑛 5 +3
The rearrangement above provides us with the iterative formula 𝑥𝑛+1 = we know that there is a
5
root in the interval [0, 1] so we will take a starting value for x0 of 1
5
Handout 20 – Numerical Methods
Cobweb and Staircase Diagrams
𝑥 5 +3
The diagram shows the graphs of y = x and 𝑦 = 5
𝑥5 + 3
𝑦= y=
5 x Remember to go
up (or down) to
the curve and
across to the
line.
x x x
b. Beginning with x0 = 1 and using xn +1 = 5 5 xn − 3 find the value of the root between 1 and 2 to three
decimal places. Draw a diagram to show how the process converges on the root.
c. Change the starting value so that x0 = 0 and using xn +1 = 5 5 xn − 3 find the value of the other root to
three decimal places.
6
Handout 20 – Numerical Methods
7
Handout 20 – Numerical Methods
The Intersection of Graphs
By sketching the curves 𝑦 = √𝑥 and 𝑦 = 3𝑥 2 – 1 find
the number of roots of the equation 3𝑥 2 – 1 = √𝑥
The graph shows _____solution (approximately_____),
which we can find to a greater degree of accuracy using
decimal search.
Now put x = 0·5 and x = 1 in and look for the change of sign:
Iteration
3
Suppose we have a sequence defined iteratively by 𝑥𝑛+1 = √(3𝑥𝑛2 − 2)
Try 𝑥1 = 2.5, 𝑡ℎ𝑒𝑛
.
𝑥2 =
.
𝑥3 = .
𝑥4 = 𝑥13 = The sequence seems to be “settling down” – i.e.
𝑥5 = converging. This means that the values of xn+1
𝑥14 =
and xn are getting closer.
𝑥6 = 𝑥15 =
8
Handout 20 – Numerical Methods
As it converges, 𝑥 𝑛+1 ≈ 𝑥𝑛
3
Hence: 𝑥𝑛+1 = √(3𝑥𝑛2 − 2)
3
becomes: 𝑥𝑛 = √(3𝑥𝑛2 − 2)
so,
finally, the iteration solves
9
Handout 20 – Numerical Methods
10
Handout 20 – Numerical Methods
11
Handout 20 – Numerical Methods
12
Handout 20 – Numerical Methods
13
Handout 20 – Numerical Methods
14
Handout 20 – Numerical Methods
15
Handout 20 – Numerical Methods
THE NEWTON-RAPHSON METHOD
⇒ 𝑓 ′ (𝑥0 ) =
Rearrange for 𝑥1 :
SUMMARY:
To use the Newton-Raphson method to estimate a root of an equation:
• rearrange the equation into the form f(x) = 0
• differentiate 𝑓(𝑥) to find 𝑓 ′ (𝑥)
16
Handout 20 – Numerical Methods
17
Handout 20 – Numerical Methods
18
Handout 20 – Numerical Methods
Can the Newton-Raphson method fail?
The Newton-Raphson method can fail when:
the starting value x0 is too far the tangent gradient is too the tangent is horizontal, where
away from the root leading to small, where f’(x) close to 0 f’(x) = 0 so the tangent will never
a divergent sequence or leading to a divergent sequence meet the x-axis
a different root. or one which converges very
slowly.
19
Handout 20 – Numerical Methods
20
Handout 20 – Numerical Methods
21
Handout 20 – Numerical Methods
The Trapezium Rule for Estimating the Area under a Curve
Objective: I understand and use numerical integration of functions using the trapezium rule to estimate
the area under a curve
Aims: I should be able to:
• Understand and use the term ‘ordinate’.
• Use graphical determination to find whether an approximation over- or under- estimates the area
• Improve approximation by increasing the number of strips.
Estimating the Area under a Curve
Suppose we wish to find the area under a curve y = f(x) between x = a and x = b.
Formula booklet:
Example1: Calculate the exact value of the integral for 𝑓(𝑥) = 𝑥 2 + 1, between x=0 and x=3. Check your
answer on calculator.
22
Handout 20 – Numerical Methods
𝐴𝑟𝑒𝑎 ≅
𝑏−𝑎
ℎ=
𝑛
number of strips
x 0 3
𝑦 = 𝑥2 + 1
Step 4: Substitute all values in the formula.
𝐴𝑟𝑒𝑎 ≅
𝑝𝑟𝑒𝑑𝑖𝑐𝑒𝑑−𝑎𝑐𝑡𝑢𝑎𝑙
%error = × 100
𝑎𝑐𝑡𝑢𝑎𝑙
23
Handout 20 – Numerical Methods
• Use 4 strips to estimate the area between x = 0 and x = 3
h=
x 0 3
𝑦
Formula:
𝐴𝑟𝑒𝑎 ≅
% error =
h=
x 0 3
𝑦
Formula:
𝐴𝑟𝑒𝑎 ≅
% error =
24
Handout 20 – Numerical Methods
• Use 8 strips to estimate the area between x = 0 and x = 3
h=
x 0 0.75 1.875 3
𝑦 1.5625 4.515625
Formula:
𝐴𝑟𝑒𝑎 ≅
25
Handout 20 – Numerical Methods
Exam type questions:
26
Handout 20 – Numerical Methods
27
Handout 20 – Numerical Methods
28
Handout 20 – Numerical Methods
29
Handout 20 – Numerical Methods
30
Handout 20 – Numerical Methods
31
Handout 20 – Numerical Methods
32