

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Guidelines: Please turn in a neat homework that gives all the formulae that you have used and all the necessary information for the grader to understand your solution. Also, if the problem requires you to write a MATLAB code, please turn in a copy of the code you used, carefully documented with comments and using proper indentation, as well as the requested ouputs and graphs, along with the written explanation of your solution. Use the codes presented in class only as a guide: just copying them or using them directly to compute the solution is not an acceptable answer. You need to write a code that does specifically what the questions ask you to do (be careful: in general, the homework problems ask something rather different than what the codes used in class were doing).
5 by solving for the root of f (x) = x^2 − 5 over the bracket [0, 4].
− Perform the incremental search on the prescribed number of segments. − If some brackets where f changes of sign are located, it should use the function FalsePos.m defined in the previous question to find one root on this bracket with the prescribed approximate relative error. If no bracket was found during the incremental search, your function should display a message at the command line. − Return as output a vector with the different roots found and display a message indicating the number of roots (including the case where no root was found).
Test this function by finding the roots of f (x) = cos(x) on [0, 2 π].
(a) Prove mathematically (without using MATLAB), that the exact solutions of g(x) = 0 are
xn =
1 + 2n
with 1 ≤ n ≤ 99.
(b) Using find_roots.m with A = 0.1, B = 10, Ns = 50 and g(x) = cos(10π/x) (remember that you need to create the function handle corresponding to g using for example g=@(x) cos(10*pi./x)), how many roots can you find? (c) Repeat the previous question with Ns = 200, Ns = 1000, Ns = 5000 and Ns = 10000. (d) Why should Ns not be taken too small? You can illustrate your answer by plotting the function g(x). What would be the disadvantage of taking N very large? (e) Propose a strategy to modify the function find_roots.m so that fewer segments are necessary in the incremental search to find all the roots (you do not need to actually modify the function, just explain what you would do and why).
Consider the following equation:
f (x) = ex^ − 3 x^2 = 0
x(n+1)^ = g(x(n))
for finding the roots of the equation. Two obvious choices for g(x) are
g−(x) = −
ex 3
and g+(x) =
ex 3
Show that g− and g+ will converge to the roots located respectively near x = − 1 /2 and x = 1 for a choice of initial guess sufficiently close to these roots. Prove also that none of these fixed-point iteration schemes will converge to the root located near x = 4.