Question

In: Advanced Math

Consider the root of function f(x) = x 3 − 2x − 5. The function can...

Consider the root of function f(x) = x 3 − 2x − 5. The function can be rearranged in the form x = g(x) in the following three ways: (a) x = g(x) = x3 − x − 5 (b) x = g(x) = (x 3 − 5)/2 (c) x = g(x) = thirdroot(2x + 5) For each form, apply fixed-point method with an initial guess x0 = 0.5 to approximate the root. Use the error tolerance = 10-5 to terminate the iteration. If the iteration does not converge within 15 steps, stop and provide an explanation for the divergence. Keep at least 6 significant digits in your calculation.

Solutions

Expert Solution

a)

clc;
clear all;


format long
% Given f(x)=(sin(x)/2)+1/2-x, we rewrire (sin(x)/2)+1/2=x
g=@(x)x^3-2*x-5; %function



x1=0.5;%initial value
tol=1e-5; % tolerence (Stoping)
erorr=0.1;
n=1;
max_iter=15;
disp('_____________________________________________________________________________________')

disp('n x(n)) g(x(n)) error')
disp('_____________________________________________________________________________________')
while(erorr>tol&n<max_iter)

  
x1(n+1)=g(x1(n));
  
%x=x1;
erorr(n)=abs(x1(n)-x1(n+1));


fprintf('%d\t%15.8f \t %15.8f \t %15.8f \n',n ,x1(n),g(x1(n)),erorr(n))
n=n+1;
end
disp('Root of function is')
y=x1(end)
disp('Number of iteration')
n-1

%%%%%%%%%%%%%%%%%%%%%

_____________________________________________________________________________________
n x(n)) g(x(n)) error
_____________________________________________________________________________________
1   0.50000000    -5.87500000    6.37500000
2   -5.87500000    -196.02929688    190.15429688
3   -196.02929688    -7532525.85236584    7532329.82306897
4   -7532525.85236584    -427387575445953770000.00000000    427387575445946240000.00000000
5   -427387575445953770000.00000000    -78066674213739856000000000000000000000000000000000000000000000.00000000    78066674213739856000000000000000000000000000000000000000000000.00000000
6   -78066674213739856000000000000000000000000000000000000000000000.00000000    -475769978281058810000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000    475769978281058810000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000
7   -475769978281058810000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000    -Inf    Inf
8   -Inf    NaN    NaN
Root of function is

y =

NaN

Number of iteration

ans =

8

>>

b)

clc;
clear all;


format long
% Given f(x)=(sin(x)/2)+1/2-x, we rewrire (sin(x)/2)+1/2=x
g=@(x)(x^3-5)/2; %function



x1=0.5;%initial value
tol=1e-5; % tolerence (Stoping)
erorr=0.1;
n=1;
max_iter=15;
disp('_____________________________________________________________________________________')

disp('n x(n)) g(x(n)) error')
disp('_____________________________________________________________________________________')
while(erorr>tol&n<max_iter)

  
x1(n+1)=g(x1(n));
  
%x=x1;
erorr(n)=abs(x1(n)-x1(n+1));


fprintf('%d\t%15.8f \t %15.8f \t %15.8f \n',n ,x1(n),g(x1(n)),erorr(n))
n=n+1;
end
disp('Root of function is')
y=x1(end)
disp('Number of iteration')
n-1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

_____________________________________________________________________________________
n x(n)) g(x(n)) error
_____________________________________________________________________________________
1   0.50000000    -2.43750000    2.93750000
2   -2.43750000    -9.74108887    7.30358887
3   -9.74108887    -464.66017665    454.91908778
4   -464.66017665    -50162178.07116126    50161713.41098461
5   -50162178.07116126    -63110142529143789000000.00000000    63110142529143738000000.00000000
6   -63110142529143789000000.00000000    -125680380630448420000000000000000000000000000000000000000000000000000.00000000    125680380630448420000000000000000000000000000000000000000000000000000.00000000
7   -125680380630448420000000000000000000000000000000000000000000000000000.00000000    -992595875594217240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000    992595875594217240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000
8   -992595875594217240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000    -Inf    Inf
9   -Inf    -Inf    NaN
Root of function is

y =

-Inf

Number of iteration

ans =

9

>>

c)

clc;
clear all;


format long
% Given f(x)=(sin(x)/2)+1/2-x, we rewrire (sin(x)/2)+1/2=x
g=@(x)(2*x+5)^(1/3); %function



x1=0.5;%initial value
tol=1e-5; % tolerence (Stoping)
erorr=0.1;
n=1;
max_iter=15;
disp('_____________________________________________________________________________________')

disp('n x(n)) g(x(n)) error')
disp('_____________________________________________________________________________________')
while(erorr>tol&n<max_iter)

  
x1(n+1)=g(x1(n));
  
%x=x1;
erorr(n)=abs(x1(n)-x1(n+1));


fprintf('%d\t%15.8f \t %15.8f \t %15.8f \n',n ,x1(n),g(x1(n)),erorr(n))
n=n+1;
end
disp('Root of function is')
y=x1(end)
disp('Number of iteration')
n-1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

_____________________________________________________________________________________
n x(n)) g(x(n)) error
_____________________________________________________________________________________
1   0.50000000    1.81712059    1.31712059
2   1.81712059    2.05151513    0.23439454
3   2.05151513    2.08799119    0.03647606
4   2.08799119    2.09355411    0.00556292
5   2.09355411    2.09439991    0.00084580
6   2.09439991    2.09452845    0.00012854
7   2.09452845    2.09454798    0.00001953
8   2.09454798    2.09455095    0.00000297
Root of function is

y =

2.094550949678837

Number of iteration

ans =

8

>>


Related Solutions

5. Consider the function f(x) = -x^3 + 2x^2 + 2. (a) Find the domain of...
5. Consider the function f(x) = -x^3 + 2x^2 + 2. (a) Find the domain of the function and all its x and y intercepts. (b) Is the function even or odd or neither? (c) Find the critical points, all local extreme values of f, and the intervals on which f is increasing or decreasing. (d) Find the intervals where f is concave up or concave down and all inflection points. (e) Use the information you have found to sketch...
Use the secant Method to find a root for the function: f(x) = x^3 + 2x^2...
Use the secant Method to find a root for the function: f(x) = x^3 + 2x^2 + 10x -20, with x_0 = 2, and x_1 = 1.
Differentiate the following: 1) f(x) = √2x-4. (all under square root) 2) f(x) = x/5-x 3)...
Differentiate the following: 1) f(x) = √2x-4. (all under square root) 2) f(x) = x/5-x 3) y=cos(4x^3) 4) f(x)=tan(x^2) 5) f(x)= 3e^2x cos(2x) 6) y= sin2x/cosx 7) y= √sin(cosx) (all under the square root)
Using Matlab, consider the function f(x) = x^3 – 2x + 4 on the interval [-2,...
Using Matlab, consider the function f(x) = x^3 – 2x + 4 on the interval [-2, 2] with h = 0.25. Write the MATLAB function file to find the first derivatives in the entire interval by all three methods i.e., forward, backward, and centered finite difference approximations. Could you please add the copiable Matlab code and the associated screenshots? Thank you!
Consider the function f(x) = x - xcosx, which has a root at x = 0....
Consider the function f(x) = x - xcosx, which has a root at x = 0. Write a program to compare the rates of convergence of the bisection method (starting with a = -1, b = 1) and Newton’s method (starting with x = 1). Which method converges faster? Why?
1. Consider the following function F(x) = {2x / 25 0<x<5            {0 otherwise a) Prove...
1. Consider the following function F(x) = {2x / 25 0<x<5            {0 otherwise a) Prove that f(x) is a valid probability function. b) Develop an inverse-transformation for this function. c) Assume a multiplicative congruential random number generator with parameters: a: 23, m: 100, and xo: 17. Generate two random variates from the function for (x).
f(x)=〖2x〗^3-cosx/5+2e^(-x) given of f(x) function,    a-Fill the table f(x) column using calculator f(x) for given...
f(x)=〖2x〗^3-cosx/5+2e^(-x) given of f(x) function,    a-Fill the table f(x) column using calculator f(x) for given x values.    b-After all calculation of table find f(1,3) Neville’s Method approximation x0=1,2 and x1=1,4    c-Find f(1,3) Neville’s Method approximation x0=1,2 x1=1,4 and x3=1,5 Tell which result is more reliable and precise in case b, and c. Why?
Find the two critical values of the function f (x) = x2/5 (5 − 2x).
Find the two critical values of the function f (x) = x2/5 (5 − 2x).
Write a Matlab function for: 1. Root Finding: Calculate the root of the equation f(x)=x^3 −5x^2...
Write a Matlab function for: 1. Root Finding: Calculate the root of the equation f(x)=x^3 −5x^2 +3x−7 Calculate the accuracy of the solution to 1 × 10−10. Find the number of iterations required to achieve this accuracy. Compute the root of the equation with the bisection method. Your program should output the following lines: • Bisection Method: Method converged to root X after Y iterations with a relative error of Z.
1. (8pt) Consider the function f(x) = (x + 3)(x + 5)^2 √ (7 − x)...
1. (8pt) Consider the function f(x) = (x + 3)(x + 5)^2 √ (7 − x) whose first and second derivatives are f'(x) = ((x + 5)(139 + 12x − 7x^2))/2 √ (7 − x) , f''(x) = (35x^3 − 225x^2 − 843x + 3481)/ 4(7 − x)^3/2 . Note: 35x 3 − 225x 2 − 843x + 3481 has three roots: x1 ≈ 7.8835, x2 ≈ −4.3531 and x3 ≈ 2.8982. (a) (1pt) What is the domain of f(x)?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT