[1, 30%] For a one-variant quadratic function f(x) = ax + bx+c, use a, b, c as input to write the 1. Function calc_root(
Posted: Sat Nov 27, 2021 10:35 am
[1, 30%] For a one-variant quadratic function f(x) = ax + bx+c, use a, b, c as input to write the 1. Function calc_root(a,b,c) to compute the roots: If b - 4ac > 0, then x=; if b’ - 4ac = 0, then x = -b/2a (replicate roots); if ' b-4ac < 0, then x has no real root; if a=0, then x = -c/b [Show your numbers to the 5" decimal digit] [Test 1] calc_root(3, 5, 1) returns “roots are -0.23241 and -1.43426" [Test 2] calc_root(4, -4, 1) returns “roots are 0.5 and 0.5" [Test 3] calc_root(4, 1, 1) returns "no real root" [Test 4] calc_root(0, 1, 1) returns “root is -1”.