> On Oct 12, 2017, at 4:22 PM, Cameron McKay <cmmc...@ualberta.ca> wrote: > > Hello, > > I've never used python trying to plot a graph. Thus I am having > difficulties trying to plot the maxwell-boltzmann distribution. right now > 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)
First of all, this only part of the formula for the Maxwell Boltzmann distribution function. It is usually written as: F(v) = (m/2 pi kT)^3/2 * 4 pi v^2 exp(-mv^2/2kT) The independent variable is v, everything else is constants. So what you want is an array of values of v (which will be the x axis). Then use a for loop to calculate F(v) for each v in the range. Finally, importing matplotlib, and plotting F(v), the y axis, as a function of the x axis will give you your (sort of) bell curve. Hope these hints help. Bill > > before i used the linspace function but i believe that was wrong as it just > gave me an exponential growth function as i need a bellcurve. > > Thanks for looking into this, > > Cameron > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor