Question: Please help with this question in Python! Prob. 7 Write a function for the following tasks: a) Use nuinpy to generate a randomi array x
Prob. 7 Write a function for the following tasks: a) Use nuinpy to generate a randomi array x = (zl ,T2, . . . ,xn) of length n, where ai's are drawn froin nonnal distribution with mean 11 and standard deviation . (This should be easily done using numpy.) b) Compute the 1-norm and 2-norm of the z generated in 7a) in a vectorized manner, i.e., without using loop. As a reminder, for (1,r2,. . ,rn), the 1-norm and 2-norm are defined, respectively, as 1/2 c) Using the same generated in 7a), compute 2-here i- i Use both a loop (save the valu s) and a vectorized operation (save the value in sd12) d) Using the same a generated in 7a), compute sd2 = Use both a loop (save the value i sd2) and a vectorized operation (save the value in sd22) The interface of your code is the following, where the mean and deviation are made keyword arguments with given default values def stat-comp (n, mean = 1000, deviation=0.32): i fill in the gap to fu Ifill the above listed tasks return the answers in a tuple (x, norml, norm2, sd1, sd12, sd21, sd22)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
