Advertisement
Coriic

Untitled

Dec 5th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. liczba_iteracji=15;
  2. epsilon_1=e^-6;
  3. epsilon_2=e^-6;
  4. x0=0;
  5. f=@(x)x^3-2*x^2-11*x+12;
  6. i=0;
  7. while i<liczba_iteracji
  8. i=i+1;
  9. x=x0-(f(x0)/diff(f(x0)));
  10. if(abs(f(x))<epsilon_1)
  11. break;
  12. end;
  13. if(abs(x-x0)<epsilon_2)
  14. break;
  15. end;
  16. x0=x;
  17. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement