Recall the Planck function from the Stefan-Boltzman notebook:

$E_\lambda* =\pi \frac{2 hc^2}{\lambda^5}\frac{1}{ e^{\frac{hc}{\lambda kT}}-1}$

where

$h$=Planck's constant ($6.63 \times 10^{-34}$ Joule seconds})

$c$= Speed of light in a vacuum ($3.00 \times 10^{8}\ \mathrm{meters/second}$)

$k_b$ =Boltzman's constant ($1.38 \times 10^{-23}\ \mathrm{Joules/Kelvin}$)

With this Python function that returns $E_\lambda^*$ given $\lambda$ and temperature:



In :

c=2.99792458e+08  #m/s -- speed of light in vacumn
h=6.62606876e-34  #J s  -- Planck's constant
kb=1.3806503e-23  # J/K  -- Boltzman's constant

def planckwavelen(wavel,Temp):
"""input wavelength in microns and Temp in K, output
bbr in W/m^2/micron
"""
wavel=wavel*1.e-6  #convert to meters
c1=2.*h*c**2.
c2=h*c/kb
Elambda=1.e-6*pi*c1/(wavel**5.*(np.exp(c2/(wavel*Temp)) -1))
return Elambda



In the cell below, write a new function, called planckInvert, that takes (wavel,Elambda) and returns a temperature. That is, use algebra to turn planckwavelen inside out so it returns the temperature that a blackbody must have to emit flux Elambda



In :



show that planckInvert is correct by doing a "round trip" test. That is, in the cell below, find Elambda=planckInvert(wavel,Temp) for Temp=300 K and wavel=10 microns. Then print planckInvert(wavel,Elambda) and show that it gives 300 K.



In :