On 2:59 PM, Richard D. Moores wrote:
On Sun, Oct 24, 2010 at 13:29, Emile van Sebille<em...@fenx.com> wrote:
From people who would know found at
http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.triangular.html
"""The triangular distribution is often used in ill-defined problems where
the underlying distribution is not known, but some knowledge of the limits
and mode exists. Often it is used in simulations."""
Emile,
from the source code link on that page, I got
# Draw values from the distribution and plot the histogram:
import matplotlib.pyplot as plt
h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=200,
normed=True)
plt.show()
Which when I run it I get
Traceback (most recent call last):
File "c:\P26Working\untitled-8.py", line 2, in<module>
h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=200, normed=True)
NameError: name 'np' is not defined
Process terminated with an exit code of 1
The import goes OK:
import matplotlib.pyplot as plt
and apparently I have numpy, if that's relevant:
import numpy
but where do I get np?
Dick
import numpy as np
see
http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/histogram_demo.py
for one example. I don't know anything about matplotlib as a whole,
this was just a lucky shot
DaveA
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor