COMPUTING II: COURSEWORK 1

Differentiation and Interpolation of Experimental Data

Your coursework should be handed in at the beginning of next week’s computing lab. session. The files mentioned below may all be downloaed from the CompII website. Make sure you write your name on all work you hand in and attach a plagiarism statement (Q:/salford/comp2/plagrsm.doc).

You learnt about the photoelectric effect in the 1st semester Quantum Physics module. This effect is commonly used in electron spectroscopy to investigate the chemical composition of a material. Electrons are ejected from a sample of the material using photons of sufficiently high energy and spectra of the number of electrons as a function of electron kinetic energy are recorded. These spectra can be used as "fingerprints" that identify the presence of a particular element within the sample.

In some cases the signal due to the element of interest can be exceptionally weak and it is necessary to differentiate the data to highlight the spectral feature related to that element. Spectral analysis is further complicated by the fact that a large number of electrons on their way out of the solid will collide with the atoms in the solid and thus lose energy. Although we are only interested in the electrons that escape without collision, the other "scattered" electrons produce a strong background signal.

N.B. In answering the following questions use fixed array sizes. For these coursework exercises it is not necessary to use the malloc() function in your programs.

 2.1(a) "electron.dat" contains data somewhat similar to that expected from an electron spectroscopy experiment. The first column represents electron energies whereas the second column of values represents numbers of electrons (or electron "intensity"). Write a program that loads the data from the file "electron.dat" into two 1D arrays (each having 100 elements) [1]. (Note that a line of the form: fscanf("%f,%f",&array1[n],&array2[n] may be used to read the data into the arrays). Load the data file directly into EasyPlot and plot a graph - note that the data runs from 100 to 200 eV and that a very small feature at a value of approximately 150 eV is visible.

 2.1(b) Add a function to your program that estimates the derivative of the electron intensity data [3]. Use a step size of 1. Import the data into EasyPlot and plot a graph, a copy of which you should hand in with your program.[½]. What happens to the feature of interest following the differentiation process? [½].

 2.1(c) Add a function to your program that estimates the number of electrons having a kinetic energy of 121.5 eV based on the known electron intensities at 119 eV, 120 eV, 121eV and 122eV. The function should use the Lagrange interpolating polynomial formula (eqn. 2.10 in the lecture notes). [5]

Guidelines for Q. 2.1(c)

Set up two arrays, each 4 elements in size. One of these will hold the values of the electron energies (i.e. 119,120,121 and 122) and the other will hold the values of the electron intensities at these energies. These arrays are then equivalent to the xi’s (or xj’s ) and f(xi)’s respectively in Eqn. 2.10. Pass both these arrays to the Lagrange() function and use a nested for loop to carry out the summation in Eqn. 2.10. (To check your Lagrange algorithm note that my program produced a value of 59706).