M3
Question 1.1: Find the root of the equation 𝑥 3 − 3𝑥 − 5 = 0 on the interval [2, 3] using bisection method correct to three decimal places. // Scilab code for Bisection method clc; clear; close; deff('y = f(x)' , 'y = x^3-3*x-5') ; x1 = 2, x2 = 3; e = 0.0001 ; c = 0 ; printf('Successive approximations \n \t x1 \t \t x2 \t \t m \t \t f(m)\n'); while abs(x1-x2)>e m = (x1+x2)/2 ; printf('\t%f\t%f\t%f\t%f\n', x1, x2, m, f(m)); if f(m)*f(x1) > 0 x1 = m ; else x2 = m ; end c = c+1 ; // to count number of iterations end printf('Solution of equation after %i iteration is %8.4f', c, m) Question 2.1. Use Newton-Raphson method to find a root of 𝑓(𝑥) = 𝑥 3 + 2𝑥 2 + 0.4 = 0 which lies near 𝑥0 = −2, with a tolerance of 0.01%. // Scilab code for Newton-Raphson method clc; clear; close deff('y=f(x)','y=x^3+2*x^2-0.4'); deff('y1=f1(x)','y1=3*x^2+4*x'); x0=-2; e=0.0001; c=0; n=1; printf('Successive iter...