Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. %newtona
  2. h=0.01;
  3. pochodna3=@(x) ((funkcja(x+h)-funkcja(x))/(2*h));
  4. pochodna22=@(x) ((funkcja(x+2*h)-2*funkcja(x)+funkcja(x-2*h))/(4*h^2));
  5. a=0;
  6. b = 6;
  7. liczbaIteracji=0;
  8. x0 = b;
  9. while(1)
  10. liczbaIteracji=liczbaIteracji+1;
  11. xn=(x0-(pochodna3(x0)/pochodna22(x0)));
  12. if(abs(xn-x0)<epsilon)
  13. break;
  14. end
  15. x0 = xn;
  16. end
  17. newtona=xn
  18. liczbaIteracji
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement