## Physics 222/322 Assignment 4

### Directions

Please turn in this assignment (and all future assignments for this course) by emailing them to me . Please use the subject of "Physics 222 HW4" for these assignments (if you use the link above, the subject will be added automatically). Please attach the any source code to programs that you write for this assignment. If you write more than one program, attach each separately. When answering the questions themselves feel free to answer directly in the body of your message (or attach your answers). I may take off points for assignments that are not sent to me in the correct form.

Write a program which find the peak wavelength in the light emitted by a blackbody. A blackbody is an ideal object that is both a perfect emitter and a perfect absorber of light. (See section 38.8 Continous Spectra, in University Physics by Young and Freeman, a similar text, or Wikipedia for more details.) The spectrum of light from follows the form of the Plank radiation law:

`I(λ) = 2πhc2/(λ5(ehc/λkT - 1))`
where I(λ) is emittance, λ is wavelength, h is Plank's constant, c is the speed of light, and T is the temperature.

Plank's radiation law gives the amount of light emitted as a function of the temperature the object and the wavelength of the light. Plots of Plank's radiation law give curves which peak at wavelength's given by Wien's law:

`λm = b/T `
where λm is the wavelength at which the maximum amount of light is emitted, T is the absolute temperature, and b is a constant which is 2.8977685 x 10-3 K*m in SI units. For this problem it will be most convenient if you use temperature in Kelvin (K), wavelengths in nm, and b = 2.8977685 x 106 K*nm.

Your program should have a function that will take a temperature in Kelvin and return a wavelength in nm. The main function of your program should call the calculation function with the input list below.

1. Your program should calculate the wavelength of the maximum emission for the following temperatures: 2.7 K (cosmic microwave background), 250 K (cold winter day), 295 K (room temperature on Earth), 2000 K (molten lava), and 5800 K (surface of Sun). Your program should print the results for these temperature to the screen. Attach a copy of those results with your assignment.
2. Your program should also create a plot of the wavelength versus temperature for the data above. Use the plplot library to create your plot. Save your plot to a file and attach a copy of your plot with your assignment.

### Using PLPlot

Before trying to use plplot, take a look at the example of a simple program using plplot. You may want to download that program and compile it using the instructions in its header. Note that there are several lines from that program that you will need to copy. You will need the include line:
`#include <plstream.h> `
You will also need to define all of the numeric variables that you use with the plot as types PLFLT and PLINT, in place of float and int. You will also need corresponding lines like the rest of the example. To compile your program, you should add:
` -I/usr/include/plplot  -lplplotcxxd  -lplplotd `
to the end of your usual compiling command. PLPlot allows you to choose from many different forms of output. While developing your program you should probably choose <11> wxwidget or <1> xwin. For your final postscript plot output you should choose <3> ps, <27> pdfcairo, or <31> pngcairo .