# Range of wavelengths for graphing Black Body Radiation

I am wanting to create graphs of spectral radiance ($B_\lambda(\lambda, T)$) against wavelength ($\lambda$) of a black body of temperature $T \text{ K}$ using Planck's Law. However, I don't know what the maximum and minimum wavelengths should be.

I've tried rearranging the Planck's Law equation for the wavelength where the $B_\lambda(\lambda, T) = 0.1$, but it's too complex.

So, what should I do to fit the majority of the curve nicely to the graph?

• LPT: when you don't know the range to plot, use an iterative process (i.e., start with 1e-9 and 1e+9 and then expand or contract as necessary). Commented Aug 28, 2017 at 12:22

The Wien displacement law tells you what the peak wavelength is:

$$\lambda_{max}=\frac{b}{T}$$

Where b = $2.897\cdot 10^{-3}~\rm{m\cdot K}$

You could start at a wavelength that is 0.1 of that, and go until a wavelength that is 100x that. If you use logarithmic scales, you will get "pretty much everything" you want. Here is a piece of code to demonstrate (Python):

from scipy.constants import codata
import numpy as np
import matplotlib.pyplot as plt

D = codata.physical_constants

h = D['Planck constant'][0]
k = D['Boltzmann constant'][0]
c = D['speed of light in vacuum'][0]
wienConstant = 2.897e-3

def planck(T, l):
# calculate the Planck Law for a specific temperature and an array of wavelengths
p = c*h/(k*l*T)
result = np.zeros(np.shape(l))+1e-99
# prevent underflow - compute only when p is "not too big"
calcMe = np.where(p<700)
result[calcMe] = (h*c*c)/(np.power(l[calcMe], 5.0) * (np.exp(p[calcMe])-1))
return result

# compute for a range of temperatures
Tbody=np.arange(2000, 12000, 2000)

Lpeak = wienConstant / Tbody

plot1 = plt.figure()

# compute Planck function for a range of wavelengths and temperatures:
for ti,T in enumerate(Tbody):
# wavelengths used: from 0.1 * peak to 100* peak
Lvec = np.logspace(-1, 2, 500) * Lpeak[ti]  # wavelengths: 1 nm - 1 mm
r = planck(T, Lvec)
ax.plot(Lvec*1e9, r, label='T=%d'%T)

# create axes and labels
plotAs = 'linear' # set to 'log' for log plot
ax.set_xlabel('lambda (nm)')
ax.set_title('Black body spectrum')
ax.legend()
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_ylim (1e-8, 2.5e14)

plt.show()


And the resulting plot:

Actually, if you use a linear plot you will find that a range of 0.1x to 10x is plenty:

Play with that, and optimize for your needs.

Incidentally - on a log scale, the shape of the function is identical for different values of T - the curve is just scaled vertically, and shifted horizontally. This is why a simple scaling of the limits relative to the peak works well.

While Kyle Kanos gives a useful tip in comments, of just iteratively changing the range until you're satisfied, it's possible you may want to systematically create a good graph. My suggestion: use the limit behaviour of the black body distribution.

Large Wavelength For large wavelength, thermal radiation is approximated by the Rayleigh-Jeans tail, given by the formula: $$B(\lambda) = \frac{2 c k_B T}{\lambda ^4}$$ You can use this to find the cut-off wavelength.

Short Wavelength Thermal radiation is described by Wien's approximation, at short wavelength, with the formula: $$B(\lambda) = \frac{2 h c^2}{\lambda ^5} e^{-\frac{h c}{\lambda k_B T}}$$

• 0 would be a bad limit because $1/0\equiv\rm undefined$. Commented Aug 28, 2017 at 16:18
• @KyleKanos true, fixed. Was thinking of the limit behaviour.
– CDCM
Commented Aug 29, 2017 at 1:04