Problem-1
Newton method
a) f(x) =0 in [-0.9,1], f(x)=x2sin(x)
We assume initial solution x0=1 and calculate improved solution successively as follows:
We assign x0 = ximp after above step and compare f(x0) with 0
It the error is less than 1E-6 we stop and see the no of iterations for convergence.
Code and output are given below:
f=@(x) x^2*sin(x);
fd=@(x) 2*x*sin(x)+x^2*cos(x);
x0=1;
iter=0;
while f(x0)>1e-6;
ximp=x0-f(x0)/fd(x0);
x0=ximp;
iter=iter+1;
if iter>100;
break;
end;
end;
x0
iter
Output
x0 =
0.0069
iter =
12
Hence root is 0.0069 wit 12 iterations.
b ) g(x) =0 in [-0.9,1], g(x)=x2sin(x)-x
Code:
f=@(x) x^2*sin(x)-x;
fd=@(x) 2*x*sin(x)+x^2*cos(x)-1;
x0=0.1;
iter=0;
while abs(f(x0))>1e-6;
ximp=x0-f(x0)/fd(x0);
x0=ximp;
iter=iter+1;
if iter>100;
break;
end;
end;
x0
iter
Output
x0 =
1.7352e-08
iter =
2
c) h(x)=0 on [-0.9,1],
The code and output are given below:
f=@(x) x^(1/3);
fd=@(x) 1/3*x^(-2/3);
x0=.1;
iter=0;
while abs(f(x0))>1e-6;
ximp=x0-f(x0)/fd(x0);
x0=ximp;
iter=iter+1;
if iter>100;
break;
end;
end;
x0
iter
Output
x0 =
-2.5353e+29 + 5.9881e+14i
iter =
101
It is seen that the solution does not converge as h'(x) tends to be 0 near the actual solution x=0 hence 1/h'(x) tends to be infinity.
Bisection method
a) Code is given below:
fun=@(x) x^2*sin(x);
iterr=0;
xa=-.9;xb=1;
xm=(xa+xb)/2;
fm=fun(xm);
while abs(fm)>1e-6;
iterr=iterr+1;
xm=(xa+xb)/2;
fm=lab4(xm);
fa=lab4(xa);
fb=lab4(xb);
if xa*fm>=0;
xa=xm;
else
xb=xm;
end
if iterr>999;
break;
end
end;
iterr
xm
Output
terr =
5
xm =
-0.0094
b) Output:
iterr =
5
xm =
-0.0094
c) Output
iterr =
5
xm =
-0.0094
Here the solution converges
Fixed point iteration
a) This function can not be put in the form x=g(x) hence solution by this method is not possible.
b) We modify the function as
Starting with initial value of 0.1 we successively calculate the improved values till we get difference between two successive values as less than 1E-6
The code is given below:
f=@(x) x^2*sin(x);
x0=0.6
iter=0;
for ii=1:100
ximp(ii)=f(x0);
if abs(x0-ximp(ii))>1e-6;
x0=ximp(ii);
iter=iter+1;
end;
end
x0
iter
Output
x0 =
5.8036e-07
iter =
3
c) This equation can not be expressed in the form
x=g(x)
Hence solution by this method is not possible
Comparison
1. Newton method does not converge when the deriavative tends to be 0 within the interval of solution.
2. Newton method may require more iterations for the type of function a)
3. Bisection method appears to be less sensitive to type of functions.
4. For the type of functions a) and c) it is not possible to express the equation in the form
x=g(x).
Hence fixed point iteration method can not be used for these functions.
5. The no of iterations required for fixed point iteration is comparable to bisection and Newton method.
Problem 2: Compare performance of Newton's method and Muller's method on the problem of finding roots...
Problem 1 (Matlab): One of the most fundamental root finding algorithms is Newton's Method. Given a real-valued, differentiable function f, Newton's method is given by 1. Initialization: Pick a point xo which is near the root of f Iteratively define points rn+1 for n = 0,1,2,..., by 2. Iteration: f(xn) nt1 In 3. Termination: Stop when some stopping criterion occurs said in the literature). For the purposes of this problem, the stopping criterion will be 100 iterations (This sounds vague,...
4.8.39 Questione The values of various roots can be approximated using Newton's method. For example, to approximate the value of V10, x V10 and cube both sides of the equation to obtain 22-10, rx-100. Therefore, 10 is a root of pix)x-10, which can be approximated by applying Newton's method. Approximate the following value of by first finding a polynomial with integer colors that has a roof Use an appropriate value of and stop calculating approximations when two c i approximations...
Please use Python Problem 2: 10 pts - Here is a cubic polynomial with three closely spaced real roots: p(x) = 580x4-2320x3-1 160x2 + 6960-1740 What are the exact roots of p? . Plot p(x) for -2 x 3 4. And plot the location of the four roots on the graph. Starting with xo2, what does Newton's method do? . Starting with 0.3 and xi0.9, what does the secant method do? Starting with the interval [0.5, 2.9, what does bisection...
Use Newton's method to find all real roots of the equation correct to eight decimal places. Start by drawing a graph to find initial approximations. (Enter your answers as a comma-separated list.) ㄨㄧ-1.955568,-1. 168721 28. 1.10856484. 2.99241114 x Use Newton's method to find all real roots of the equation correct to eight decimal places. Start by drawing a graph to find initial approximations. (Enter your answers as a comma-separated list.) ㄨㄧ-1.955568,-1. 168721 28. 1.10856484. 2.99241114 x
2. (a) Explain Newton's Method, which lets you improve approximations to roots of a function f(x) by following the tangent line down to the x-axis. (b) What if, instead of following a best fit straight line, you were to follow a best fit parabola? What's the equation of this parabola, and of its intersection with the x-axis? Compared with Newton's Method, how quickly do the approximate roots computed using this method typically converge to the exact root? (c) The method...
4. (20 pts) In this problem, we combine the Steepest Descent method with Newton's method for solving the following nonlinear system. en +en-13 = 0, 12-2113 = 4. Use the Steepest Descent method with initial approximation x0,0,0 three iterations x(1), x(2), and x(3) to find the first ·Use x(3) fron the above the result as the initial approximation for Newton's iteration. Use the stopping criteria X(k)-s(k 1) < tol = 10 9 Display the results for each iteration in the...
Show it in Matlab. thx! 5. Formulate Newton's method for the system x = y v = Note that this system has three real roots (-1,-1), (0,0) and (1,1). By taking various initial points in the square -2 <ry < 2, try to obtain the attraction regions of these three roots. P.S. An attraction region of a root is defined as the set of all initial points which will eventually converge to the root.
explain why newtons method doesnt work for finding the root of the equation x^3-3x+9=0 if the initial approximation is chosen to be x1=1 f(x)=x^3-3x+9 -> f'(x)= . if x1=1 then f'(x1)= and the tangent line ued for approximating x2 is . attempting to find x^2 results in trying to by zero 1. [-/100 Points) DETAILS SCALCETS 4.8.031. MY NOTES Explain why Newton's method doesn't work for finding the root of the equation if the initial approximation is chosen to be...
4. Suppose you are interested in using Newton's Method for finding the positive square root of a positive real number a Assume that the initial guess to > 0 and o va. Prove or disprove the following: (a) In+1 = 0.5(In + -). (b) Inti?-a-( ") for non negative n. Thus show that in > Va for all positive n. (c) The iterates I, are strictly decreasing sequence for n 1. (d) Ife, V -In what is lentile, in terms...
Newton's Method in MATLAB During this module, we are going to use Newton's method to compute the root(s) of the function f(x) = x° + 3x² – 2x – 4 Since we need an initial approximation ('guess') of each root to use in Newton's method, let's plot the function f(x) to see many roots there are, and approximately where they lie. Exercise 1 Use MATLAB to create a plot of the function f(x) that clearly shows the locations of its...