Question: python Write and test a Boolean function: hasComplexRoots(a, b, c), that returns True if the quadratic ax+bx+c= 0 has em complex roots and False otherwise.
python
Write and test a Boolean function: hasComplexRoots(a, b, c), that returns True if the quadratic ax+bx+c= 0 has em complex roots and False otherwise. -6+ 62 4ac Note: The roots of the quadratic above are given by x = 2a Using the function has ComplexRoots(a, b, c), to compute the probability Pi(n) (the Monte Carlo estimate) that the quadratic has complex roots, assuming that the coefficients are drawn from a uniform random distribution on [0, 1], (using random.random()). Run the simulation for n= 1000. Repeat the experiment to compute P2(n), where the coefficients are chosen from a normal distribution (random.normalvariate(0, 1)) with mean mu 0 and std. deviation sigma = 1. =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
