http://import numpy as np, pylab as pl Nfreq, NT = 2000, 6 T = [ 3000, 5000,10000,20000,30000] f = np.arange(0, Nfreq) nu = f*1e12 # Hz c = 299792458. # m/s h = 6.62606957e-34 # J/s k = 1.3806488e-23 # J/K e = np.zeros( (NT, Nfreq) ) B = np.zeros( (NT, Nfreq) ) for i in range(NT): e[i,:] = np.exp((h*nu[:])/(k*T[i])) B[i,:]=((2*h*nu[:]**3)/c**2)*(1/(e[i,:]-1)) pl.plot(f,B[i,:],label='%s K'%(T[i])) pl.hold(True) leg = pl.legend(loc='upper right', fancybox=True) leg.get_frame().set_alpha(0.5) pl. title('Planck curve ', fontsize=17) pl.xlabel('Frequency [Hz]', fontsize=17) pl.ylabel('Intensity [$W m^{-2} sr^{-1} Hz^{-1}$]', fontsize=17) pl.savefig('Planck curve _.png', bbox_inches='tight', transparent=True) pl.show()
2.1m questions
2.1m answers
60 comments
57.0k users