Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a=-2; b=0;
- for i=1:500
- poly_a=a^3+3*a^2-a-4;
- poly_b=b^3+3*b^2-b-4;
- TOL=1e-12;
- if poly_a*poly_b<TOL
- c=(a+b)/2;
- poly_c=c^3+3*c^2-c-4;
- end
- if poly_a*poly_c<TOL
- b=c;
- else
- a=c;
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement