3.12:
x = (-b± sqrt(b^2-4ac))/2a
3.13
x=-2c/(b± sqrt(b^2-4ac))
x^2 - 5000.002x+10
Compute percent relative errors for your results
a = chop(1,5);
b = chop(-5000.002,5);
c = chop(10,5);
%3.12
x1 = chop((-b + sqrt(b^2 - 4*a*c))/(2*a),5);
x2 = chop((-b - sqrt(b^2 - 4*a*c))/(2*a),5);
%3.13
x1b = chop((-2*c)/(b + sqrt(b^2 - 4*a*c)),5) ;
x2b = chop((-2*c)/(b - sqrt(b^2 - 4*a*c)),5) ;
display(x1);
display(x1b);
display(x2);
display(x2b);
percenterror = ((5000 - x1)/5000) *100;
percenterrorb = ((5000 - x1b)/5000) *100;
percenterror2 = ((.002 - x2)/.002) *100;
percenterror2b = ((.002 - x2b)/.002) *100;
The roots are 5000 and .002
No comments:
Post a Comment