We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Been stuck on Q3 for a while. The error I get says that plt.plot cant take a generator.
def pdf(x): a = (1/(x0.5 (2np.pi)**(1/2))) math.exp(-1* ((math.log10(x) - 11)2)/(2 (0.5*2))) return a
grid = np.linspace(0, 150000, num= 150000)
#fig, ax = plt.subplots(figsize=(10, 6)) #ax.hist(obs, bins=40, normed=True) new = map(pdf, grid) plt.plot(grid, new, 'k-', linewidth=2) plt.show()
The text was updated successfully, but these errors were encountered:
Hi Aly. Here are some suggestions:
map
numpy
new
Compare
def pdf(x): a = x**2 return a grid = np.linspace(-5, 5, num= 20) new = map(pdf, grid) plt.plot(grid, new, 'k-', linewidth=2) plt.show()
with
def pdf(x): a = x**2 return a grid = np.linspace(-5, 5, num= 20) new = list(map(pdf, grid)) plt.plot(grid, new, 'k-', linewidth=2) plt.show()
After running new = map(pdf, grid), you'll see this:
new = map(pdf, grid)
math.exp
math.log
np.exp
np.log
Let me know if this helps!
Sorry, something went wrong.
No branches or pull requests
Been stuck on Q3 for a while. The error I get says that plt.plot cant take a generator.
def pdf(x):
a = (1/(x0.5 (2np.pi)**(1/2))) math.exp(-1* ((math.log10(x) - 11)2)/(2 (0.5*2)))
return a
grid = np.linspace(0, 150000, num= 150000)
#fig, ax = plt.subplots(figsize=(10, 6))
#ax.hist(obs, bins=40, normed=True)
new = map(pdf, grid)
plt.plot(grid, new, 'k-', linewidth=2)
plt.show()
The text was updated successfully, but these errors were encountered: