[Tutor] coding help with maxwell-boltzmann distribution

Peter Otten __peter__ at web.de
Fri Oct 13 12:13:38 EDT 2017


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)




More information about the Tutor mailing list