Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Q2) Write a Scilab program for Secant i=i+ 1;
  2. Method to solve end
  3. f (x) z x3 — 2x — 5. Take initial root as printf("\n\nThe approximate root of the
  4. x_1 : 1 and x0 : 2. equation is:%f",xnm);
  5. Program: endfunction
  6. . _ . . _ A * .
  7. function secant(xn, xm, t) deff( y—f(x) ' y—X 32 X5 )
  8. _ secant(1,2,f)
  9. disp("Secant Method");
  10. printf("\n\ti\txi- 1\t\txi\t\tf(xi-
  11. 1)\t\tf(xi)\t\tx(i+1)");
  12. i=0;
  13. while(i<5)
  14. xnmzxm- ((f(xm)*(xn-xm)) /(f(xn) -f(xm))) ;
  15. printf("\n\t%d\t%f\t%f\t%f\t%f\t%f",i,x
  16. n,xm,f(xn),f(xm),xnm);
  17. xnzxm;
  18. xmzxnm;
  19.  
  20. Free Online OCR newocr.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement