Write a program which takes 2 digits xy as input and


I -

1. Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in the i-th row and j-th column of the array should be i * j.

2. Define a function which can generate and print a list where the values are square of numbers between 1 and 20.

Write proper doc string for the function

3. Write a program that calculates and prints the value according to the given formula:

Q=√(2∗C∗D)/H

Following are the fixed values of C and H:

C is 50. H is 30.

D is the variable whose values should be input to your program in a comma-separated sequence.

4. Write a program to compute the frequency of the words from the input. The output should print after sorting the key alphanumerically.

II-

PART ONE: Linear Algebra in Python

1) create the vector v=(3,7) and plot it.

# importing future for compatibility between python 2 and python 3

from __future__ import print_function

# importing needed packages

import numpy as np

import pylab as pl

# The dollowing command (it is called a magic command)

# is needed to display plots in the notebook.

%pylab inline

Populating the interactive namespace from numpy and matplotlib

2) modify vector v so as to get a vector twice as long, in the same direction of v=(3,7). Call the new vector vLong and plot it. For this and all following plots also plot the orivinal vector v with a dashed, grey line.

3) create a function, that takes as argument an angle (in degrees) and returns a roatation matrix (also a numpyndarray). Name the function rotMatrix.

defrotMatrix(angle):

4) apply the rotation matrix to the vector v=(3,7) and rotate it by 30 degrees counterclockwise, call this vector v30, and then by 90 degrees clockwise call this vector v90. plot them.

5) Sum the vectors vLong and v90. Plot the original vectors with dashed grey lines and the resulting vector.

PART TWO: Bayes theorem

1. Two connected devices A and B have the following probabilities of failure: P(A)=6% and P(B)=5%, while once second device fails the first one does so with the conditional probability of $P(A|B)=60\%$. a) What is the probability of two devices failing together? b) What is the probability of the second device to fail once the first one did?

2. Given three stocks of devices A,B,C, such that A has 5% of defective items in it, B has 10% and C has 3%, we pick up a random device from a random stock and it turns out to be defective. What is the probability that it came from the stock C?

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program which takes 2 digits xy as input and
Reference No:- TGS01570940

Expected delivery within 24 Hours