[Tutor] coding help with maxwell-boltzmann distribution
D.V.N.Sarma డి.వి.ఎన్.శర్మ
dvnsarma at gmail.com
Fri Oct 13 12:50:32 EDT 2017
Yes we can vectorize.
regards,
Sarma.
On Fri, Oct 13, 2017 at 9:43 PM, Peter Otten <__peter__ at 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 this without Python loop as
>
> v = np.arange(0, 4, 0.1)
> f = v**2 * np.exp(-v**2)
>
>
> _______________________________________________
> 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