Law of Large Numbers via Simulation
Swipe to start coding
You will implement a Python function that demonstrates the law of large numbers using samples drawn from a standard normal distribution.
Your task is to complete the required parts of the code so that:
- The function accepts an integer
n_samples. - Generates
n_samplesindependent samples from a normal distribution with mean 0 and standard deviation 1 using NumPy. - Computes the running mean after each newly drawn sample.
- Plots the running mean against the sample index using Matplotlib.
- Draws a horizontal line at 0, representing the theoretical mean of the distribution.
Follow the placeholders in the task code.
Use only numpy and matplotlib.
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Awesome!
Completion rate improved to 7.14
Law of Large Numbers via Simulation
Deslize para mostrar o menu
Swipe to start coding
You will implement a Python function that demonstrates the law of large numbers using samples drawn from a standard normal distribution.
Your task is to complete the required parts of the code so that:
- The function accepts an integer
n_samples. - Generates
n_samplesindependent samples from a normal distribution with mean 0 and standard deviation 1 using NumPy. - Computes the running mean after each newly drawn sample.
- Plots the running mean against the sample index using Matplotlib.
- Draws a horizontal line at 0, representing the theoretical mean of the distribution.
Follow the placeholders in the task code.
Use only numpy and matplotlib.
Solução
Obrigado pelo seu feedback!
single