Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Q2) Write a Scilab program for Secant i=i+ 1;
- Method to solve end
- f (x) z x3 — 2x — 5. Take initial root as printf("\n\nThe approximate root of the
- x_1 : 1 and x0 : 2. equation is:%f",xnm);
- Program: endfunction
- . _ . . _ A * .
- function secant(xn, xm, t) deff( y—f(x) ' y—X 32 X5 )
- _ secant(1,2,f)
- disp("Secant Method");
- printf("\n\ti\txi- 1\t\txi\t\tf(xi-
- 1)\t\tf(xi)\t\tx(i+1)");
- i=0;
- while(i<5)
- xnmzxm- ((f(xm)*(xn-xm)) /(f(xn) -f(xm))) ;
- printf("\n\t%d\t%f\t%f\t%f\t%f\t%f",i,x
- n,xm,f(xn),f(xm),xnm);
- xnzxm;
- xmzxnm;
- Free Online OCR newocr.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement