Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Law of Large Numbers via Simulation | Random Sampling and Probabilistic Foundations
Quizzes & Challenges
Quizzes
Challenges
/
Simulation and Monte Carlo Modeling with Python

bookLaw of Large Numbers via Simulation

Compito

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:

  1. The function accepts an integer n_samples.
  2. Generates n_samples independent samples from a normal distribution with mean 0 and standard deviation 1 using NumPy.
  3. Computes the running mean after each newly drawn sample.
  4. Plots the running mean against the sample index using Matplotlib.
  5. 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.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Suggested prompts:

Can you explain this in simpler terms?

What are the main points I should remember?

Can you give me an example?

close

bookLaw of Large Numbers via Simulation

Scorri per mostrare il menu

Compito

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:

  1. The function accepts an integer n_samples.
  2. Generates n_samples independent samples from a normal distribution with mean 0 and standard deviation 1 using NumPy.
  3. Computes the running mean after each newly drawn sample.
  4. Plots the running mean against the sample index using Matplotlib.
  5. 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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 4
single

single

some-alt