Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. a=-2; b=0;
  2. for i=1:500
  3. poly_a=a^3+3*a^2-a-4;
  4. poly_b=b^3+3*b^2-b-4;
  5. TOL=1e-12;
  6. if poly_a*poly_b<TOL
  7. c=(a+b)/2;
  8. poly_c=c^3+3*c^2-c-4;
  9. end
  10.  
  11. if poly_a*poly_c<TOL
  12. b=c;
  13. else
  14. a=c;
  15. end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement