You are on page 1of 4

Foundations of Learning Theory

Assignment - 1
Name: Vanaja Chandra Kodali
Roll no: 18EC39002

Question:
Write computer program (matlab, python, C etc) and show the following.
1.
Draw n uniform random variables (X_k) in the interval [0, 10]. For n =
10, 100, 1000, 10000, 100000, 1000000, 10000000 compute the arithmetic
means of the random variable. Plot in the logarithmic scale (mean vs n).

2. In the same experiment, shift and scale the random variable


values such that the resulting random variables are of zero mean and
unity variance. Then for n = 1000, compute (1/sqrt(n))* Sum (X_k). This
random variable is say Y_j. Compute value of Y_j for 10000 repeated
experiments. Plot the histogram (approximate density function) generated
by bin filling.
3. Consider a box function B(x) in the interval
[-1,1]. Compute the repetitive convolution of B(x) with itself n times
and plot it. Do it for n = 2, 3, 4, 5, 6, 7, 8, 9, 10.

In the report, just mention the assumptions, so the plots. You don't need to write any theory.

Solutions:

1. Following is the Matlab code:


Here is the plot of part 1:

2. Matlab code for part 2:


Plot for part 2:

3. Matlab Code:
Plot for question 3:

Assumptions Made in the provided plots are:

1. I defined the box function B(x) as equal to 1 within the interval [-0.5, 0.5] and 0
elsewhere. This is a standard definition of a box function.

2. I used the convolution operation to convolve the box function with itself repeatedly.
Convolution is a linear mathematical operation that combines two functions to produce a
third function. In this case, I repeatedly convolved the box function with itself to achieve
the desired repetitive convolution effect.

3. For plotting purposes, I assumed a range of x values from -3 to 3. The range was
chosen to ensure that the convolution results are visually meaningful within the specified
interval [-1, 1].

4. I normalized the convolution results by dividing by the total number of x values


(numel(x)) to ensure that the area under the curves remains consistent across different
values of n.

You might also like