Problem 6.4.
Determine the lowest positive root of f(x) = 7sin(x)e-x - 1: (a) Graphically. (b) Using the Newton-Raphson method (three iterations, x0 = 0.3). (c) Using the secant method (three iterations, x-1 = 0.5 and x0 = 0.4). (d) Using the modified secant method (five iterations, x0 = 0.3, δ = 0.01).
Solution:
(a) Plot the graph using MATLAB. The commands are shown as below:
>> x = linspace(-1,2);
>> fx = 7*sin(x).*exp(-x)-1;
>> plot(x,fx),grid,xlabel('x'),ylabel('f(x)')
The graph generated is shown as above. As shown by the graph, there are two roots. The lowest positive root is between 0 and 0.5. By maximizing the graph, the root is estimated as 0.17.
(b) Firstly, compute the first derivative of the function. (Recall Product Rule)
which can be substituted along with the original function to give
Starting with the initial guess of x0 = 0.3, the iterative equation can be applied to compute:
Hence, after three iterations, the root estimate is 0.17018 with an approximate error of 0.453%.(c) The iterative equation using secant method is
Begin the iteration with x-1 = 0.5 and x0 = 0.4 yields
First iteration:
x-1 = 0.5 f(0.5) = 1.0355
x0 = 0.4 f(0.4) = 0.8272
x1 = 0.0028
The calculation can be continued to yield
Thus, after three iterations, the root estimate is 0.17899 with an approximate error of 21.9%.
(d) The iterative equation using modified secant method is
First iteration:
x0 = 0.3 f(0.3) = 0.5325
x0 + δx0 = 0.3030 f(0.3030) = 0.5427
x1 = 0.1437
The calculation can be continued to yield
Hence, after five iterations, the root estimate is 0.17018 with a zero percent approximate relative error.
Additional: The real root of the equation can be found using fzero function in MATLAB.
>> format long>> fx =@(x) 7*sin(x).*exp(-x)-1;
>> xr = fzero(fx,0.3)
xr =
0.170179993753835
Discussion:
In conclusion, the Newton-Raphson method and modified secant method both give comparably accurate result with the true root value. In addition, modified secant method is able to attain the efficiency of Newton-Raphson method without having to compute derivatives.
No comments:
Post a Comment