[Tutor] coding help with maxwell-boltzmann distribution
D.V.N.Sarma డి.వి.ఎన్.శర్మ
dvnsarma at gmail.com
Fri Oct 13 11:35:06 EDT 2017
Except for some constants the essential behaviour of Maxweell-Boltzmann
distribution is determined by
v**2 * exp(-v**2)
The following code will gove you
a plot of the shape of the curve.
from matplotlib import pyplot as plt
import numpy as np
f = np.zeros(40)
v = np.arange(0,4,0.1)
for i in np.arange(0, 40):
f[i] = v[i]**2*(np.exp(-v[i]**2))
plt.plot(v,f)
plt.show()
regards,
Sarma.
On Fri, Oct 13, 2017 at 11:28 AM, Mark Lawrence via Tutor <tutor at python.org>
wrote:
> On 12/10/17 21:22, Cameron McKay 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)
>>
>> 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
>>
>>
> Hopefully this helps https://docs.scipy.org/doc/sci
> py/reference/generated/scipy.stats.maxwell.html
>
> --
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
>
> Mark Lawrence
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list