# [Tutor] coding help with maxwell-boltzmann distribution

Alan Gauld alan.gauld at yahoo.co.uk
Thu Oct 12 20:11:37 EDT 2017

```On 12/10/17 21:22, Cameron McKay wrote:

> I've never used python trying to plot a graph. Thus I am having
> difficulties trying to plot the maxwell-boltzmann distribution.

Bear in mind that this list is for people learning the Python
language and its standard library(as defined on python.org).
As such most of us will have no specialist domain knowledge

> i've defined the y-axis given the probability, but the difficult part is
> trying to plot x in the form of:
>
> x = v/(2kT/m)^(1/2)

It's not clear how x and y are related - which is what you are
seemingly trying to plot?

You define x in terms of v, k, T, and m

but you offer no clue what these are, where they come from etc.
Are they variables? constants? Are you trying a 3D plot of x/y
against one of these values?

Also I don't think ^(1/2) - a bitwise xor - is the python
expression you really want? I'm guessing you maybe mean
pow(0.5) or math.sqrt()?

> before i used the linspace function

linespace is not a builtin, is it part of the plotting
library you are using? I'm guessing it's the SciPy package
but I'm not sure?

> Thanks for looking into this,

You need to give us a lot more context.

If it is a SciPy problem there is a SciPy mailing list
where you may get more specialist readers who already
are familiar with your problem domain. But for this list
you need to assume we have almost zero knowledge of the
domain, only of the language.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos

```