Question
coding language=python. Thank you! Write a function compute_average (from scratch) that computes and returns the average of the values in an array. Then, generate arrays
coding language=python. Thank you!
Write a function compute_average (from scratch) that computes and returns the average of the values in an array.
Then, generate arrays of different lengths n where n takes the values from [10,10^2,510^2,10^3,510^3,10^4,510^4,10^5,510^5,10^6,510^6][10,102,5102,103,5103,104,5104,105,5105,106,5106]. The arrays contain random numbers that are uniformly distributed over the interval [0,1)[0,1). Basically, loop through these different values of n, for each n make a uniformly distributed array of length n. Compute the array average for each n. Plot this average value versus n using a log scale for the x-axis. Make sure to label the axes and give the plot a title. What do you observe as n increases? Look up information about the law of large numbers
Question 5: Write a function compute_average (from scratch) that computes and returns the average of the values in an array Then, generate arrays of different lengths n where n takes the values from [10, 102,5 x 102, 10, 5 x 10", 104,5 x 104, 109.5 x 109, 100,5 x 10). The arrays contain random numbers that are uniformly distributed over the interval [0, 1). Basically, loop through these different values of n, for each n make a uniformly distributed array of length n. Compute the array average for each n. Plot this average value versus n using a log scale for the x-axis. Make sure to label the axes and give the plot a title. What do you observe as n increases? Look up information about the law of large numbers. # Put your pseudocode, in the form of comments, and code here
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