Facebook
From Gentle Mockingjay, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 237
  1. clc
  2. clear all
  3. format long
  4. a=-1.5;
  5. b=-0.75;
  6. eps=10^(-6);
  7. x0=a;
  8. y0=b;
  9. Z0=(x0+y0)/2;
  10. i=0;
  11. while abs(funkcja(Z0))>eps
  12.     Z0=(x0+y0)/2;
  13.     i=i+1;
  14.     if funkcja(x0)*funkcja(Z0)<0
  15.         y0=Z0;
  16.     else
  17.         x0=Z0;  
  18.     end
  19. end
  20. Z0
  21. i