INPUT: -
# Wien's Formula for Black Body Radiation
import matplotlib.pyplot as plt
import numpy as np
h=6.626e-34
c=3e8
k=1.38e-23
t=float(input('Enter the value of temperature= '))
xn=float(input('Enter the value of wavelength till which you want to get the corresponding values= '))
d=float(input('Enter the value of increment in wavelength= '))
x0=float(input('Enter the value of initiating wavelength= '))
def f(x,t):
return ((8*np.pi*h*c/(x**5))*np.exp(-h*c/(x*k*t)))
X=[]
Y=[]
while(x0<=xn):
x0=x0+d
y=f(x0, t)
X.append(x0)
Y.append(y)
plt.plot(X, Y)
plt.title('Wiens law for Black Body Radiation')
plt.xlabel('Wavelength')
plt.ylabel('Energy Density corresponding to wavelength')
plt.show()
OUTPUT: -
Enter the value of temperature= 4500
Enter the value of wavelength till which you want to get the corresponding values= 0.000002
Enter the value of increment in wavelength= 0.0000000001
Enter the value of initiating wavelength= 0.00000001
Sayantan Datta©2022
Comments
Post a Comment