I am trying to graph a Blackbody's radiated power per unit energy range. My code is the following:
import numpy as np
import math
import matplotlib.pyplot as plt
h = 6.626*(10**(-34))
c = 3*(10**8)
k = 1.38*(10**(-23))
T = 1000
x = np.array(range(100))
y = (x**3)/((math.exp(x/(k*T)))-1)
# Create the plot
plt.plot(x,y)
# Show the plot
plt.show()
And I get the following error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-18-86ad11932249> in <module>
9
10 x = np.array(range(100))
---> 11 y = (x**3)/((math.exp(x/(k*T)))-1)
12
13 # Create the plot
TypeError: only size-1 arrays can be converted to Python scalars
Could someone explain why what I have is wrong?