Solution of Equations & Differentiation(Numerical Method)
Bisection Method
e−x=x
Use bisection method to find a root on the interval [0,1]
Solution:
Let f(x)=e−x−x,x∈[0,1]
f is continuos and since f(0)=1 and f(1)=−0.6321, by the Intermediate Value Theorem, there exists a root in [0,1]
Let a(0)=0 and b(0)=1
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)0011−0.63210.50.1065
Compare f(a(k))|f(a(k)+b(k)2)|f(b(k)) and choose the two value with opposite sign and insert into the next row
⇒1|0.1065|−0.6321⏟ opposite sign
Let a(1)=0.5 and b(1)=1
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)10.50.10651−0.63210.75−0.2776
Compare f(a(k))|f(a(k)+b(k)2)|f(b(k))
⇒0.1065|−0.2776⏟opposite sign|−0.6321
Let a(2)=0.5 and b(2)=0.75
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)20.50.10650.75−0.27760.625−0.0897
Compare f(a(k))|f(a(k)+b(k)2)|f(b(k))
⇒0.1065|−0.0897⏟opposite sign|−0.2776
Let a(3)=0.5 and b(3)=0.625
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)30.50.10650.625−0.0897⋯⋯
**To approximate how many iterations will bisection method get to a certain accuracy**
Use the formula :b−a2n>ε(accuracy)
Assume ε=10−4,x∈[0,1], a=0,b=1
By applying the formula:
1−02n>10−4nlog2>log110−4n>13.2877n≈14
∴ Approximately, 14 iterations will get an accuracy of 10−4
Newton's Method
f(x)=−x3−cosx
Use Newton's method to find x2, with x0=−1
Solution:
General Formula: xk+1=xk−f(xk)f′(xk)
Step 1: Find the derivative of f(x)
f′(x)=−3x2+sinx
Step 2: Apply the general formula with k=0,1,2,3,...
When k=0,
x1=x0−−(x0)3−cos(x0)−3(x0)2+sin(x0)=(−1)−−(−1)3−cos(−1)−3(−1)2+sin(−1)=−0.88033290
When k=1,
x2=x1−−(x1)3−cos(x1)−3(x1)2+sin(x1)=(−0.88033290)−−(−0.88033290)3−cos(−0.88033290)−3(−0.88033290)2+sin(−0.88033290)=−0.865684
Secant Method
f(x)=x2−6,x0=3,x1=2
Use Secant method to find x3
Solution:
General Formula: xk+1=xk−xk−xk−1f(xk)−f(xk−1)f(xk)
Apply the general formula with k=1,2,3,...
When k=1,
x2=x1−x1−x0f(x1)−f(x0)f(x1)=2−2−3−2−(3)(−2)=2.4
When k=2,
x3=x2−x2−x1f(x2)−f(x1)f(x2)=2.4−2.4−2−0.24−(−2)(−0.24)=2.454545
Richardson's Extrapolation
f(x)=x2cosx
Find an approximation to f′(1.0) with Richardson's extrapolation with h=0.1 to an order O(h8)
Solution:
hN1(h)=f(1.0+h)−f(1.0−h)2h,O(h2)N2(h)=22N1(h2)−N1(h)22−1,O(h4)N3(h)=24N2(h2)−N2(h)24−1,O(h6)N4(h)=26N3(h2)−N3(h)26−1,O(h8)0.1N1(0.1)=f(1.0+0.1)−f(1.0−0.1)2(0.1)0.05N1(0.05)=f(1.0+0.05)−f(1.0−0.05)2(0.05)N2(0.1)=22(N1(0.05))−(N1(0.1))22−10.025N1(0.025)=f(1.0+0.025)−f(1.0−0.025)2(0.025)N2(0.05)=22(N1(0.025))−N1(0.05)22−1N3(0.1)=24(N2(0.05))−N2(0.1)24−10.0125N1(0.0125)=f(1.0+0.0125)−f(1.0−0.0125)2(0.0125)N2(0.025)=22(N1(0.0125))−N1(0.025)22−1N3(0.05)=24(N2(0.025))−N2(0.05)24−1N4(0.1)=26(N3(0.05))−N3(0.1)26−1
hN1(h)=f(1.0+h)−f(1.0−h)2h,O(h2)N2(h)=22N1(h2)−N1(h)22−1,O(h4)N3(h)=24N2(h2)−N2(h)24−1,O(h6)N4(h)=26N3(h2)−N3(h)26−1,O(h8)0.1N1(0.1)=0.2267360.05N1(0.05)=0.236031N2(0.1)=0.2391290.025N1(0.025)=0.238358N2(0.05)=0.239134N3(0.1)=0.2391340.0125N1(0.0125)=0.238940N2(0.025)=0.239134N3(0.05)=0.239134N4(0.1)=0.239134
∴f′(1.0)≈0.239134
e−x=x
Use bisection method to find a root on the interval [0,1]
Solution:
Let f(x)=e−x−x,x∈[0,1]
f is continuos and since f(0)=1 and f(1)=−0.6321, by the Intermediate Value Theorem, there exists a root in [0,1]
Let a(0)=0 and b(0)=1
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)0011−0.63210.50.1065
Compare f(a(k))|f(a(k)+b(k)2)|f(b(k)) and choose the two value with opposite sign and insert into the next row
⇒1|0.1065|−0.6321⏟ opposite sign
Let a(1)=0.5 and b(1)=1
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)10.50.10651−0.63210.75−0.2776
Compare f(a(k))|f(a(k)+b(k)2)|f(b(k))
⇒0.1065|−0.2776⏟opposite sign|−0.6321
Let a(2)=0.5 and b(2)=0.75
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)20.50.10650.75−0.27760.625−0.0897
Compare f(a(k))|f(a(k)+b(k)2)|f(b(k))
⇒0.1065|−0.0897⏟opposite sign|−0.2776
Let a(3)=0.5 and b(3)=0.625
ka(k)f(a(k))b(k)f(b(k))a(k)+b(k)2f(a(k)+b(k)2)30.50.10650.625−0.0897⋯⋯
**To approximate how many iterations will bisection method get to a certain accuracy**
Use the formula :b−a2n>ε(accuracy)
Assume ε=10−4,x∈[0,1], a=0,b=1
By applying the formula:
1−02n>10−4nlog2>log110−4n>13.2877n≈14
∴ Approximately, 14 iterations will get an accuracy of 10−4
Newton's Method
f(x)=−x3−cosx
Use Newton's method to find x2, with x0=−1
Solution:
General Formula: xk+1=xk−f(xk)f′(xk)
Step 1: Find the derivative of f(x)
f′(x)=−3x2+sinx
Step 2: Apply the general formula with k=0,1,2,3,...
When k=0,
x1=x0−−(x0)3−cos(x0)−3(x0)2+sin(x0)=(−1)−−(−1)3−cos(−1)−3(−1)2+sin(−1)=−0.88033290
When k=1,
x2=x1−−(x1)3−cos(x1)−3(x1)2+sin(x1)=(−0.88033290)−−(−0.88033290)3−cos(−0.88033290)−3(−0.88033290)2+sin(−0.88033290)=−0.865684
Secant Method
f(x)=x2−6,x0=3,x1=2
Use Secant method to find x3
Solution:
General Formula: xk+1=xk−xk−xk−1f(xk)−f(xk−1)f(xk)
Apply the general formula with k=1,2,3,...
When k=1,
x2=x1−x1−x0f(x1)−f(x0)f(x1)=2−2−3−2−(3)(−2)=2.4
When k=2,
x3=x2−x2−x1f(x2)−f(x1)f(x2)=2.4−2.4−2−0.24−(−2)(−0.24)=2.454545
Richardson's Extrapolation
f(x)=x2cosx
Find an approximation to f′(1.0) with Richardson's extrapolation with h=0.1 to an order O(h8)
Solution:
hN1(h)=f(1.0+h)−f(1.0−h)2h,O(h2)N2(h)=22N1(h2)−N1(h)22−1,O(h4)N3(h)=24N2(h2)−N2(h)24−1,O(h6)N4(h)=26N3(h2)−N3(h)26−1,O(h8)0.1N1(0.1)=f(1.0+0.1)−f(1.0−0.1)2(0.1)0.05N1(0.05)=f(1.0+0.05)−f(1.0−0.05)2(0.05)N2(0.1)=22(N1(0.05))−(N1(0.1))22−10.025N1(0.025)=f(1.0+0.025)−f(1.0−0.025)2(0.025)N2(0.05)=22(N1(0.025))−N1(0.05)22−1N3(0.1)=24(N2(0.05))−N2(0.1)24−10.0125N1(0.0125)=f(1.0+0.0125)−f(1.0−0.0125)2(0.0125)N2(0.025)=22(N1(0.0125))−N1(0.025)22−1N3(0.05)=24(N2(0.025))−N2(0.05)24−1N4(0.1)=26(N3(0.05))−N3(0.1)26−1
hN1(h)=f(1.0+h)−f(1.0−h)2h,O(h2)N2(h)=22N1(h2)−N1(h)22−1,O(h4)N3(h)=24N2(h2)−N2(h)24−1,O(h6)N4(h)=26N3(h2)−N3(h)26−1,O(h8)0.1N1(0.1)=0.2267360.05N1(0.05)=0.236031N2(0.1)=0.2391290.025N1(0.025)=0.238358N2(0.05)=0.239134N3(0.1)=0.2391340.0125N1(0.0125)=0.238940N2(0.025)=0.239134N3(0.05)=0.239134N4(0.1)=0.239134
∴f′(1.0)≈0.239134
Comments
Post a Comment