# What probability denisity function would we consider if we wanted to initialise the component-wise velocities of a gas rather than the magnitudes?

Some context: I'm trying to make a molecular dynamics simulation in python and want to initialise the velocities of all particles according to some temperature T.

The Maxwell-Boltzmann distribution (if I understand it correctly) is for the distribution of speeds and not for the component-wise velocities.

What I want to do is pick the velocities, component-wise from some probability density. So what probability denisity would I use? Should I use the Maxwell-Boltzmann distribution itself? And if so then what would be the mean velocity in each direction?

My overall doubt roots from the question: Does the Maxwell-Boltzmann distribution behave same for speeds as well as component-wise velocities?

EDIT: Thanks @GeorgioP. Also just to sum it up

• If we're picking velocities in one dimension we use the density:

$$f(v_x) = \sqrt{\dfrac{kT}{m}}\:\cdot\:e^{-\dfrac{mv_x^2}{2kT}}$$

and

• if we're picking speeds then :

$$f(v) = ({\dfrac{kT}{m}})^{3/2}\:\cdot\:e^{-\dfrac{mv^2}{2kT}}$$

Check out http://hyperphysics.phy-astr.gsu.edu/hbase/Kinetic/maxspe.html for more clarity.

At constant temperature, each cartesian component of the velocity $$v_i$$, ($$i = x,y,z$$) has a gaussian probability distribution proportional to $$e^{\frac12\beta mv_i^2}$$ ($$\beta = \frac{1}{k_BT}$$).