# EE380 Project 3 Uniform Distribution solution

\$30.00

Original Work ?

## Description

5/5 - (1 vote)

Question 1)
Perhaps one of the most important distribution is the uniform distribution for continuos random
variable. The uniform (0, 1) distribution is used as the basis for simulating most random variables.

A random variable that is uniformly distributed over the interval (a, b) follows the probability density
function (pdf) given by:
𝑓(𝑥; 𝑎, 𝑏) =
1
𝑏−𝑎
; 𝑎 < 𝑥 < 𝑏 (1)

The cumulative distribution function (cdf) for a uniform random variable is:
𝐹(𝑥) = {
0 𝑥 ≤ 𝑎
𝑥−𝑎
𝑏−𝑎
𝑎 < 𝑥 < 𝑏
1 𝑥 ≥ 𝑏
(2)

The uniform probability density function and cumulative distribution function over interval (a, b) can be
defined using function stats.uniform.pdf and stats.uniform.cdf in Python (Scipy package), respectively.

a) Now with (a, b) = (1, 10), write a Python code to compute pdf and cdf using equation (1) & (2),
then plot them using subplot function.

b) Repeat question (a) using stats.uniform.pdf and stats.uniform.cdf functions. Then compare
plots from (a) and (b).

(Defining the domain x over which you will evaluate the function by yourself)

Question 2)
Three points #1, #2, and #3 are selected at random from the circumference of a circle (see figure). Write
Python code to find the probability that the three points lie on the same semicircle.

Notice: The solution for each answer should be the Python code, followed by the plots. Answer which
has no Python code will not get any credit.