Question: In this problem we shall consider the effect of computer arithmetic in the evaluation of the quadratic formula r_1, 2 = -b plusminus squareroot b^2

 In this problem we shall consider the effect of computer arithmetic

In this problem we shall consider the effect of computer arithmetic in the evaluation of the quadratic formula r_1, 2 = -b plusminus squareroot b^2 - 4ac/2a for the roots of p(x) = ax^2 + bx + c. (a). Write a Matlab function, call it quadroots, that takes a, b, c as input and returns the two roots as output. The function may start like this: function [r1, r2] = quadroots (a, b, c) % inputs: a, b, c: coefficients for the polynomial ax^2 + bx + c = 0. % output r1, r2: The two roots for the polynomial Use the formula in (??) for the computation. Run it on a few test problems to make sure that it works before you go ahead with the following problems. (b). Test your quadroots for the following polynomials: 2x^2 + 6x - 3 x^2 - 14x + 49 3x^2 - 123454321x + 2 What do you get? Why are the results pretty bad for the last polynomial? Can you explain

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!