Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB quadform: function [x1,x2] = quadform(a,b,c) d = sqrt(b^2 - 4*a*c); x1 = (-b + d) / (2*a); x2 = (-b - d) / (2*a);
MATLAB
quadform:
function [x1,x2] = quadform(a,b,c)
d = sqrt(b^2 - 4*a*c);
x1 = (-b + d) / (2*a);
x2 = (-b - d) / (2*a);
Write a function quadform2 that implements the quadratic formula differently from quadform above (page 19). First compute
x1 = (bsign(b)sqrt(b^2 - 4ac))/ 2a
which is the root of largest magnitude, and then use the identity x1x2 = c/a to find x2.
Apply both quadform and quadform2 to find the roots of x2 (10^7 + 10^7)x + 1. Do you see why quadform2 is better?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started