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

bookLaw of Large Numbers via Simulation

Oppgave

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.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 4
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

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

Sveip for å vise menyen

Oppgave

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 4
single

single

some-alt