Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need the function to take in the exact same inputs as in the blue box above. I also need the the answers to be
I need the function to take in the exact same inputs as in the blue box above. I also need the the answers to be returned in a tuple (x,norm1,norm2,sd11,sd12,sd21,sd22)
Prob. 7 Write a function for the following tasks: a) Use numpy to generate a random array x = (z, x2, . . . ,xn) of length n, where x's are drawn from normal distribution with mean and standard deviation . (This should be easily done using numpy.) b) Compute the 1-norm and 2-norm of the r generated in 7a) in a vectorized manner, i.e., rn), the 1-norm and 2-norm are defined, respectively, as c) Using the same x generated in 7a), compute r2_z?, where-=- ri Use both a loop (save the value in sd11) and a vectorized operation (save the value in sd12) d) Using the same r generated in 7a), compute Use both a loop (save the value in sd21) 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 fulfill the above listed tasks return the answers in a tuple (x, norml, norm2, sd11, sd12, sd21, sd22)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started