Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribedpython

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago