Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
Yes we can vectorize. regards, Sarma. On Fri, Oct 13, 2017 at 9:43 PM, Peter Otten <__pete...@web.de> wrote: > D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > > 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)) > > Note that you can write

Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread Peter Otten
D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > 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)) Note that you can write this without Python loop as v = np.arange(0, 4, 0.1) f = v**2 * np.exp(-v**2)

Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
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

Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread Mark Lawrence via Tutor
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 =

Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-12 Thread William Ray Wing
> On Oct 12, 2017, at 4:22 PM, 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

[Tutor] coding help with maxwell-boltzmann distribution

2017-10-12 Thread Cameron McKay
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