0% found this document useful (0 votes)
24 views8 pages

Data Science Using Python

The document contains 12 questions related to vectors, matrices, probability distributions and random variables for a minor assignment. The questions cover topics like addition and multiplication of vectors, generating and extracting rows and columns of matrices, mean of lists of vectors, plotting histograms and normal distributions, and approximating binomial distributions with normal distributions.

Uploaded by

faujiantony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views8 pages

Data Science Using Python

The document contains 12 questions related to vectors, matrices, probability distributions and random variables for a minor assignment. The questions cover topics like addition and multiplication of vectors, generating and extracting rows and columns of matrices, mean of lists of vectors, plotting histograms and normal distributions, and approximating binomial distributions with normal distributions.

Uploaded by

faujiantony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Department of Computer Science & Engineering

Faculty of Engineering & Technology (ITER)

Minor Assignment-2

Q1. Write a menu-driven program to perform Addition, Subtraction, Scalar Multiplication,

Dot Product and Length of vectors.

OUTPUT:
Department of Computer Science & Engineering
Faculty of Engineering & Technology (ITER)

Q2. . Write a program that takes the order of the matrix and creates a matrix in the

following manner: The (ij)th entry of the matrix should be the sum of i and j. Eg: The
0th row and 0 th column should have the value (0+0) i.e. 0 and the 0 th row and
first column should have value (0+1) i.e. 1 and so on

OUTPUT:

Q3 Write two functions that extract the rows and columns of a matrix A .
Department of Computer Science & Engineering
Faculty of Engineering & Technology (ITER)

OUTPUT:

Q4. Write a function to compute the component-wise mean of a list of vectors. Assert
the condition that the vectors must be of same length.

OUTPUT:

Q5. Generate a list of 100 random integers between 1 and 100 and plot a histogram of
the same.
Department of Computer Science & Engineering
Faculty of Engineering & Technology (ITER)

OUTPUT:

Q6. Write a program to find median of a given list of integers. Combine both odd and
even number of terms.
Department of Computer Science & Engineering
Faculty of Engineering & Technology (ITER)

OUTPUT:

Q7. We have defined the function normal cdf. Write a program to invert normal cdf to find
the value corresponding to a specified probability.

Q8. Plot the Normal PDFs using various value of µ and σ as mentioned below:
µ σ
0 1
0 2
0 0.5
-1 1
Department of Computer Science & Engineering
Faculty of Engineering & Technology (ITER)

OUTPUT:

Q9. Do the same as above question for Normal CDFs using the same values of µ and σ.

OUTPUT:
Department of Computer Science & Engineering
Faculty of Engineering & Technology (ITER)

Q10. What are random variables? Give two examples.

Definition:
A random variable is a variable whose possible values have an associated probability distribution.
Example:
If a coin flip turns up heads and 0 if the flip turns up tails.

Q11. What are independent events? Give two examples of the same.

Definition:
Two events are considered independent if the occurrence of one event does not affect
the probability of the other event occurring.
Example:
a) Rolling a fair six-sided die, Event E is rolling a 4 and Event F is rolling an odd number
(1, 3, or 5). Both have equal chances (1/6 and 1/2, respectively) and are independent.

b)Drawing cards, Event E is drawing a red card and Event F is drawing a face card. The
probabilities are 1/2 and 3/13, respectively, and they are independent.

Q12. Using the Binomial(n, p) distribution plot a histogram to show the actual binomial
samples. Use a line chart to show the normal approximation. Plot both in the same graph. Take
n=100, p=0.75 and number of points should be 100.
Department of Computer Science & Engineering
Faculty of Engineering & Technology (ITER)

OUTPUT:

You might also like