Upload
nickolas-berry
View
225
Download
0
Embed Size (px)
Citation preview
Solving equations numerically
The sign - change rule
If the function f(x) is continuous for an interval a x b of its domain , if f(a) and f(b) have opposite signs, then there is at least one root of f(x) = 0 between a and b.
Consider an equation f(x) = x2 -5x + 2 = 0
-6
-4
-2
0
2
4
6
8
10
-1 0 1 2 3 4 5 6
y
x
f(0) = 2
f(1) = -2There is a sign-change
This means that there is a solution between x = 0 and x = 1.
Solving equations numerically
The sign - change ruleConsider an equation f(x) = (2x – 1)(x – 1)(2x – 3)
f(0) = -3
f(2) = 3There is a sign-change
-3
-1
1
3
-1 0 1 2x
y
It is clear from the graph that
there are three roots between
x = 0 and x = 2
ExamplesShow that a root of the equation x3 – 5x – 4 = 0 lies in the interval [2, 3].
f(2) = 23 – 5 2 – 4 = 8 – 10 – 4 = - 6 < 0
f(3) = 33 – 5 3 – 4 = 27 – 15 – 4 = 8 > 0
There is a change of sign so the root lies in the interval [2, 3]
4.32 is an approximation to a root of the equation xlnx – 2 – x = 0. Check its accuracy to 2 decimal places.
f(4.315) = 4.315 ln4.315 – 2 – 4.315 = - 0.00605 < 0
f(4.325) = 4.325 ln4.325 – 2 – 4.325 = 0.00858 > 0
Change of sign, so the root is accurate to 2 decimal places.
Decimal searchConsider f(x) = x3 – 5x – 4 ; f(2) = - 6 and f(3) = 8
f(2.5) = 2.53 – 5 2.5 – 4 = -0.875
f(2.6) = 2.63 – 5 2.6 – 4 = 0.576
f(2.55) = 2.553 – 5 2.55 – 4 = -0.169
For 1 decimal place the root is 2.5 or 2.6
x = 2.5 is ignored so the root must be x = 2.6 for one decimal place.
-10
-8
-6
-4
-2
0
2
4
6
-3 -2 -1 0 1 2 3
y
x
Use decimal search to find each root correct to two decimal places.
(i) f(x) = x + (x3 + 1) - 7
x f(x) sign
0 -6.0000 negative
1 -0.5858 negative
2 -2.0000 negative
3 0.2915 positiveA root lies between 2 and 3 and it is probably closer to 3.
2.6 -0.0900 negative
2.7 0.2479 positive
A root lies between 2.6 and 2.7 and it is probably closer to 2.6.
2.62 -0.0229 negative
2.63 0.0180 positive
A root lies between 2.62 and 2.63 and it is probably closer to 2.63.
2.625 -0.0060 negative This confirms that the root is 2.63
Use decimal search to find each root correct to two decimal places.
(ii) f(x) = x5 + x3 - 1999
x f(x) sign
2 -1959 negative
3 -1729 negative
4 -911 negative
5 1251 positiveA root lies between 4 and 5.
4.5 -62.59 negative
4.6 158 positiveA root lies between 4.5 and 4.6.
4.54 23.34 positive
4.53 1.576 positiveA root lies between 4.52 and 4.53.
4.525 -9.236 negative This confirms that the root is 4.53.
4.52 -20.00 negative
IterationConsider the equation f(x) = x2 – 5x + 2 = 0
The graph of f(x) shows that one root lies between 0 and 1 and the other root lies between 4 and 5.
-6
-4
-2
0
2
4
6
-1 0 1 2 3 4 5 6
f(x)
x
First step is rearrange x2 – 5x + 2 = 0 in the form x = g(x)
Possible rearrangements:
x2 = 5x – 2
x = (5x – 2)
5x = x2 + 2
x = (x2 + 2)/5
x2 – 5x = - 2
x(x – 5) = -2
x = 2/(5 – x)
x2 = 5x – 2
x = 5 – 2/x
Graph of rearranged equations
-6
-4
-2
0
2
4
6
-1 0 1 2 3 4 5 6
-6
-4
-2
0
2
4
6
-1 0 1 2 3 4 5 6
-6
-4
-2
0
2
4
6
-1 1 3 5
x = (5x – 2)
x = (x2 + 2)/5
-4
-2
0
2
4
6
0 1 2 3 4 5
x = 5 – 2/x
x = 2/(5-x)
Using xn+1 = g(xn)
f(x) = x2 – 5x + 2 = 0 xn+1 = (5xn – 2)
Starting value x0 = 4
x1 = (5 4 – 2) = 4.2426
x2 = 4.3833
x3 = 4.4628
x4 = 4.5071
x5 = 4.5316
x6 = 4.5451
x7 = 4.5525
x8 = 4.5566x9 = 4.5588
x10 = 4.5600
x11 = 4.5607
x12 = 4.5611
x13 = 4.5613
x14 = 4.5614
x15 = 4.5615x16 = 4.5615
4.56
root = 4.56 (2 d.p.)
f(x) = x2 – 5x + 2 = 0 xn+1 = (xn
2 + 2)/5
x0 = 4
x1 = 3.600
x2 = 2.9920
x3 = 2.1904
x4 = 1.3598
x5 = 0.7697
x6 = 0.5185
x7 = 0.4538
x8 = 0.4412
x9 = 0.4389x10 = 0.4385
x11 = 0.4385
xn+1 = 2/(5 – x)
x1 = 2.0000
x0 = 4
x2 = 1.2000
x3 = 0.6880
x4 = 0.4947
x5 = 0.4489
x6 = 0.4388
x7 = 0.4485
x8 = 0.4385
xn+1 = 5 – 2/xn
x0 = 4
x2 = 4.5556
x3 = 4.5610
x4 = 4.5615
x5 = 4.5615
x1 = 4.5000
x0 = 4.5
4.5
4.51
4.52
4.53
4.54
4.55
4.56
4.57
4.58
4.59
4.6
4.5 4.51 4.52 4.53 4.54 4.55 4.56 4.57 4.58 4.59 4.6
xn+1 = 5 – 2/xn
ExampleConsider x3 – 5x – 4 = 0 , rearrange in the form xn+1 = f(xn)
x3 = 5x + 4 3 5 4x x
Let x0 = 2
x1 = 2.41012x2 = 2.52250
x3 = 2.55159
x4 = 2.55902
x5 = 2.56091
x6 = 2.56139
x7 = 2.56151
x8 = 2.56154x9 = 2.56155
x10 = 2.56155
ExampleUsing iteration method formula xn+1 = 2 + ln(xn), find a root of the equation ln(x) – x + 2 = 0, (correct to 3 s.f.) and starting with x0 = 2. x0 = 2
x1 = 2.693 147 181x2 = 2.290 710 465
x3 = 3.095 510 973
x4 = 3.129 952 989
x5 = 3.141 017 985
x6 = 3.144 546 946
x7 = 3.145 699 825
x8 = 3.146 026 848
x9 = 3.146 140 339
-1
0
1
2
3
4
0 1 2 3 4
y
x
So a root is 3.15 (3 s.f.)