1_ In one of my software projects, I need to implement Planck\'s Law in terms of
ID: 1378537 • Letter: 1
Question
1_ In one of my software projects, I need to implement Planck's Law in terms of wavelength. I can't be sure if it's right because I've seen different variations of it, and all the implementations that I've tried give different results (besides, it's been years since I've had to do physics). Could someone verify that it's correct? Have I got the units right?
It looks something like this, and it's the implementation of Planck's Law in terms of wavelength found on this wikipedia page:
h = 6.6260695729e-34 J*s
k = 1.3806488e-23 J*K^-1
c = 2.998e8 m/s
c2 = pow(c, 2) m^2/s^2
h_c = h * c
_2_h_c2 = 2.0 * h * c2
planck(wavelength, temp) {
return _2_h_c2 / (pow(wavelength, 5.0) * (exp(h_c / (wavelength * k * temp)) - 1.0))
}
temp is the temperature in Kelvins, and wavelength is in nanometers.
2_ If I wanted it normalized about 555nm, similar to this wikipedia page, what would it look like? This is what I have so far, but, again, I can't be sure if it's right:
planck(wavelength, temp) {
Real norm = pow(555.0, 5.0) * (exp(h_c / (555.0 * k * temp)) - 1.0);
return norm / (pow(wavelength, 5.0) * (exp(h_c / (wavelength * k * temp)) - 1.0));
}
3_ Say I have an array of wavelengths from 360nm to 830nm, in increments of 5nm, and I apply the planck function with temperature of 6504k to each wavelength, and store the results in a new array. If I use this new array (spectral power distribution) and calculate the XYZ values for it, it should match CIE Standard Illuminant D65, should it not?
Explanation / Answer
From the Wikipedia link you posted, it looks like CIE Standard Illuminant D65 does not exactly model a black body spectrum. Look at the animation in the second figure. The red line is a perfect black body spectrum and the black line is the D65 one. I believe this is because the purpose of D65 is to represent the spectrum of daylight on an average day at Earth's surface. Thus it's approximately a black body spectrum (because the Sun is, to a good approximation, a black body), but the D65 spectrum also includes the effect of absorption by various things in the atmosphere.
For this reason, you shouldn't expect your XYZ values based on a perfect black body spectrum to perfectly match those obtained from the D65 standard. I haven't checked your code in detail, but it looks plausible, so if you're getting approximately correct answers then it's probably right.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.