# Homework #4

All problems must be in a single *.m file. You may need an additional files for a functions or class definitions. Make a separate block in the code for each problem. Do not submit individual files for each problem. See previous solutions.

## Problem 1 (2 Points)

The Maxwell-Boltzmann distribution describes the distribution of particle energies, velocities, or speeds in an ideal gas. The velocity distribution for each Cartesian dimension is a Gaussian distribution with

.

For particles, draw velocity components from this distribution. Use the result to calculate the speed and energy of each particle. Use histograms and overlayed plots to show that the speed and energy distribution of your particles match

and

respectively. Use Nitrogen at STP for your calculations. Plots should have units indicated.

## Problem 2 (1 Point)

Use the Inversion method to generate random numbers from the standard () Normal distribution using 'rand'. Convince the grader it is working using a histogram. Hint: 'help erf'

## Problem 3 (1 Point)

A simple, and somewhat accuate method for generating random numbers from the standard normal distibution makes use of the Central Limit Theorem. Show

sum(rand(12,1))-6


produces numbers similar to randn(). Why does this work? What is the variance of a uniform distibution on 0 to 1? Hint:

## Problem 4 (1 Point)

On average, a particular constant-rate process generates 4 events. What percentage of the time does it produce exactly 4 events?

## Problem 5 (1 Point)

Generate a 3D random walk and show the results using 'plot3'.