Language:
C#
Dialect:
Microsoft Visual C# Express 2010
Discussion:
The Planck Curve relates the "irradiance" at a given temperature and wavelength to those factors:
Iλ = c1 / [λ5 [1 - exp(c2 / {λ T})]
where c1 and c2 are the 1st and 2nd radiation constants, respectively. To find the fraction of irradiance between two wavelengths, then, you need only integrate this equation between those wavelengths. Unfortunately, this equation falls into a class that cannot be integrated! But an iterative approximation was worked out some time in the years 1910-1930 (I'd be grateful if anyone can point me to a primary source). The algorithm is produced below in the C# programming language. Please note that what this routine does is give you the fraction of the Planck curve betweeen 0 and a given wavelength, known as "D." To get the fraction between two wavelengths, you need D(λ2) - D(λ1), where λ2 > λ1.
// D returns the Planck fraction from 0 to a given wavelength. static double D(double lambda, double T) { const double c2 = 14387.77; const double pi = 3.141592653589793; const double k = 15.0 / (pi * pi * pi * pi); double q = c2 / (lambda * T); double sum = 0.0; for (int m = 1; m < 200; m++) { double f = m * q; double term1 = Math.Exp(-f) / (m * m * m * m); double term2 = f * (f * (f + 3.0) + 6.0) + 6.0; sum += (term1 * term2); } return k * sum; } // D
Page created: | 06/14/2013 |
Last modified: | 06/14/2013 |
Author: | BPL |