Skip to main content

Posts

Showing posts from June, 2022

Plot Planck's law for Black Body radiation and compare it with Wein's Law and Raleigh-Jeans Law at high temperature (room temperature) and low temperature using Python

INPUT :- #SAYANTAN DATTA / 6TH SEM / ROLL-074  #DATE - 08-04-2022  import numpy as np  import matplotlib.pyplot as plt  h=6.626e-34  k=1.38e-23  pi=3.14159  c=3e8  l1=float(input("Enter the value of lower wavelength = "))  l2=float(input("Enter the value of higher wavelength = "))  lw0=float(input("Give an upper limit of wavelength value for Wiens = "))  lr0=float(input("Give the lower limit of wavelength value for Rayleigh Jeans = "))  T1=float(input("Give the first value of temperature in Kelvin = "))  T2=float(input("Give the second value of temperature in Kelvin = "))  T3=float(input("Give the third value of temperature in Kelvin = "))  l=np.linspace(l1,l2,1000)  lw=np.linspace(l1,lw0,1000)  lr=np.linspace(lr0,l2,1000)  def p(l,T):   y=h*c/(l*k*T)   x=np.exp(y)   return (8*pi*h*c)/((l**5)*(x-1))  def w(lw,T):   y=h*c/(lw*k*T)   x=np.exp(y)...

Plotting Wien's Law for Blackbody Radiation with the Help of Python

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 in...