Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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