Instructor's solution: planck_peak.sci |
Instructor's solution: planck_integ.sci |
Your job in this project: write programs to
You may not use Scilab's built-in functions for finding maxima or performing numerical integration -- instead, please implement these algorithms yourself.
You'll need to create two different Scilab source code files this week:
The first function should look like this:
function peak_lambda = planck_peak(start_lambda, end_lambda, temp, epsilon)where
peak_lambda is the output argument: the wavelength at which a blackbody of the given temperature radiates the most energy start_lambda is the starting wavelength of the interval (in meters) to check for a peak end_lambda is the ending wavelength of the interval (in meters) to check for a peak temp is the temperature of the blackbody in question, in degrees Kelvin epsilon is the fractional relative error to use as a termination criterion
For this week's exercise, please always use the interval between 1e-8 and 1e-3 meters. Set epsilon = 1e-6.
You may stop when you have convinced yourself that
[ (true peak lambda - your peak lambda) ] abs [ --------------------------------------- ] < epsilon [ true peak lambda ]
This task is very, very much like searching for a root. The key difference is that you don't know the value of the function at the peak wavelength, whereas you do know the value of a function at its root (it's zero!). Here's a tip: the Planck function is smooth, and has a single, global peak value; therefore, the slope of the function at any point always points towards the peak. If you always go "uphill" from your current guess, you'll head towards the peak.
Of course, in order to determine the slope, you'll either have to differentiate the Planck function with respect to wavelength (ick!), or use an approach like the Secant Method (Chap 6.3) to estimate the derivative.
I'll even provide the pseudocode I used when writing this function myself. You should create an outline of the same depth (if not deeper) before you start to write any actual code.
Use your program to find the peak wavelength of emission for a blackbody of these temperatures:
Make a table and a graph showing the peak wavelength as a function of temperature. Is there a simple relationship between temperature and peak wavelength?
The second task is to calculate the energy emitted by a blackbody at some temperature per second, per square meter per steradian, in the band between two wavelengths. Your function for this task should look like this:
function energy = planck_integ(start_lambda, end_lambda, temperature, epsilon)where
energy is the output argument: the energy emitted per second per square meter per steradian by a blackbody of the given temperature between the given wavelengths start_lambda is the starting wavelength of the interval (in meters) to integrate end_lambda is the ending wavelength of the interval (in meters) to integrate temp is the temperature of the blackbody in question, in degrees Kelvin epsilon is the fractional relative error to use as a termination criterion
Set epsilon = 1e-6.
Use your program to determine the energy emitted per second per square meter for the following cases:
As a check, try this integral:You should find a total emitted power of about 8 million Joules per second per square meter of surface area per steradian.
- temp 5600 K, start_lambda 400 nm, end_lambda = 800 nm
Your program is computing the energy emitted by a perfect blackbody, per square meter, per steradian. That last term -- per steradian -- breaks the total emitted power by the solid angle. If we consider a flat plate, 1 meter on a side, and ask how much energy it emits from one face, then we are integrating up all the power emitted in (2 pi) steradians. This integral turns out to yield a multiplicative factor of (pi). So, if you multiply your integral by (pi), you should end up with the amount of power emitted per square meter.
Use the Stefan-Boltzmann equation to calculate the total power emitted by one square meter of a blackbody in each of these cases. How close does your program come to calculating the total energy in each case? Comment upon the answer.
Bells and Whistles
This page maintained by Michael Richmond. Last modified Apr 8, 2007.
Copyright © Michael Richmond. This work is licensed under a Creative Commons License.