P3.1-9 p86 f(x) = cos(x) - cos(3x) Which roots will be easy to find? Which roots will be hard to find? Write a MabLab program for graphical solution.
X f(x) = cos(x) – cos(3x) What are the multiplicities of these roots?
y = inline(‘log(x+1)/(1-x.*x)’); x = linspace(-0.5, 2, 100); plot(x,y(x)) What is wrong with this MatLab code? With fplot we don’t need to create a vector of x values. P p86: y=log(x+1)/(1-x 2 ); Where are the roots?
What is wrong with this plot? >> p1031=inline('log(1+x)/(1-x^2)'); >> fplot(p1031,[0,2]);
X f1031(x) = ln(x+1)/(1-x 2 ) x(1)=-0.5; y(1)=f1031(x(1)); for i=2:149 x(i)=x(i-1)+0.01; y(i)=f1031(x(i)); end x(150)=1.01; y(150)=f1031(x(150)); for i=151:199 x(i)=x(i-1)+0.01; y(i)=f1031(x(i)); end plot(x,y)
Computer problems 1, 2, 4, 7 will give you practice with your bisection code. Ignore details like those in #7 “one run”, “full machine precision”, “correct number of steps” and “false positive method” How can you be sure that your code is giving correct answers?
P3.3-2: f(x) = x 3 - 2x +2 if x 0 = 0 and x 1 = 1 in secant method, what is x 2 ? P3.3-3 f(x) = x 5 + x 3 +3 if x n-2 = 0 and x n-1 = 1 in secant method, what is x n ? See slide 33 in Lectures on finding zeros.
P3.3-5: find the largest positive root of x 3 - 5x +3 by bisection, newton’s and secant methods
Computer problems 1, 3, 5, 6, 7 will give you practice with your secant code. I think cp3.3-3 is referring to functions on p77 of text. I think cp3.3-5 is referring to example 1 on p113 of text f(x) = x 5 + x 3 +3