Use Newton’s method to find an approximation to the first positive zero of f(x)=
ID: 3027404 • Letter: U
Question
Use Newton’s method to find an approximation to the first positive zero of f(x)=xtan(x)-1.
(a) Solve the equation numerically using MATLAB:
format long
f=@(x) x*tan(x)-1
sol = fzero(f,[0,1])
Why are we guaranteed at least one solution in the interval [0,1]?
(b) Find the derivative of f(x).
(c) Using ½+10/n as your starting value, provide your iterative formula
(d) Use MATLAB to write and execute a routine. How many iterations does it take for your answer to match the answer given in a? Do you have fast (quadratic) or slow (linear) convergence? Why? Display the intermediate approximate solutions as a table.
Explanation / Answer
on script page
clear all
f=@(x)x*tan(x)-1
df=@(x)x*sec(x)^2+tan(x)
x0=input('enter initial guess')
while abs(f(x0))>0.0001
x1=x0-(f(x0)/df(x0))
x0=x1
end
On work space
f =
@(x)x*tan(x)-1
df =
@(x)x*sec(x)^2+tan(x)
enter initial guess0.5
x0 =
0.5000
x1 =
1.1080
x0 =
1.1080
x1 =
0.9466
x0 =
0.9466
x1 =
0.8710
x0 =
0.8710
x1 =
0.8605
x0 =
0.8605
x1 =
0.8603
x0 =
0.8603
>>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.