Assignment – 1
- Approximate for any given a 6= 0 without using division. Hint: Use Newton’s method with proper justification.
- Implement the following iterative root finding method to find real roots of the non-linearequation f(x) = 0.
Additionally, calculate the order of convergence numerically and print/display it after each iteration (starting from the 3rd iteration). Use this program to find a root of f(x) = x4 −16x3 +89x2 −194x+120 using the initial guess x0 = 1.5. The following formula for calculating the order of convergence may be used:
.
- Use the following method to find two sequences uk and vk such that all the values f(uk), k = 0,1,2,… have one sign and all the values f(vk) have the opposite sign.
Method: We define uk+1 = wk, vk+1 = vk if f(wk) has the same sign as f(uk), and otherwise uk+1 = uk, vk+1 = wk where
Use a default value k = 10 as a stopping criterion of the algorithm.
- Write a function that combines the bisection and Newton’s method in the following way:
Start with the bisection method with an initial interval [a,b] and switch to Newton’s method when the length of the current interval in the bisection method becomes less than s(b − a). Try the new method on tanh(x) = 0 with an initial interval [−10,15] and s = 0.1.
Instructions:
- Each problem carries 5 marks.
- Any descriptive answer should be written at the top of the code. Use ‘%’ to comment inside the code.
- Make Matlab script for each of the above problems and submit only the ‘.m’ file in gradescope.
- The final code should run without any error.
- Code will be checked manually. Checker will only hit run, and he/she will not provide any input during checking. Everything should be specified in each code.
- Please do not take the risk of copying or sharing your code with classmates. Code similarity will be checked.
- Use tol = 1e − 10 for the stopping criterion of the iterations.
- Any other input required for the code can be specified by yourself.
1



