Anda di halaman 1dari 5

Excel 7.

0 Spreadsheet Practical for


‘Scientific Applications of Computers’
Level 2
INTRODUCTION

A spreadsheet is essentially a very powerful programmable calculator that can be


used in many different ways for scientific, statistical and financial calculations. Its
essential ingredient is its ability to carry out tedious repetitive calculations with
instantaneous graphical output. We shall be looking at various examples in
Chemistry of how useful they can be. The program we shall be using is Excel 7.0
for Windows 2000 and NT. This workshop will give you the basics of using Excel,
and there will be another workshop run by Prof Brereton later in the year which
follows on from this with more advanced applications of Excel.

The main way of operating Excel is with the mouse, using both the left and right
buttons, however, all of the functions of Excel can be used via the keyboard by
pressing the Alt Key followed by the appropriate underscored letter.

First load Excel by double clicking on the icon. Excel may load to fill the whole
screen. If not you can expand the window to full size using the  icon in the top
right hand corner of the Excel window.

If at any time you get stuck, the Help function (top right) contains virtually all you
need to know about the program.

In the figure (below) a small part of the Worksheet window is shown. The cells in
the notebook can be accessed by clicking on them with the mouse. A highlight will
appear around the cell. The contents of a cell may be entered (or edited) by clicking
in the cell and typing, or by moving to the desired cell and clicking in the bar near
the top of the screen which
displays the text or formula in that
cell. The Insert, Home, End and
Delete Keys can be used to edit
the text and the cursor keys (on the
keyboard) for moving along the
text. When you have finished
editing you can either click on
another cell or press the ENTER
Key ↵.
Exercise 1: Sine Table and Graph

Go to cell A1 and type in 1 followed by the Enter Key ↵. This value will now appear
in cell A1. Now click on cell B1 and type =sin(a1), then press the Enter Key. The
value for the sine of one (0.84) will appear in cell B1. The = is required to tell the
program you need one of its functions, otherwise it would give you the text sin(a1).
You can find the other functions in the Help.

To obtain a whole sine wave, first we need to create a column of numbers, say 1 to
20. We could do this by typing them in, in each of the A cells from 1 to 20. But
luckily there is a quicker way:

1. Click on cell A2 and enter the number 2.


2. Highlight cells A1 and A2 together by keeping your finger on the LH mouse
button. Cell A1 should have a white background and cell A2 should be
highlighted.
3. You should notice that in the bottom right hand corner of cell A2 there is a little
square. If you move the cursor (no buttons pressed) over the little square, the
cursor changes from a big white cross to a small black cross. Now click and hold
the LH mouse button and drag down to cell A20. The cells in the A column
should fill with the numbers 1 to 20. You must highlight the first two cells in
Column A to show Excel that you want an increment of 1.
4. Now click on cell B1 so that the rectangle highlights it, and use the same trick to
COPY the contents of cell B1 down to cell B20. If you now click on cell B2 you
will see it says =SIN(A2). The program automatically increments the cell number
for you.
5. To plot this as a graph, highlight from A1 to B20 with the mouse. Then click on
Insert, Chart. Choose an XY Scatter chart, and click on the ‘smooth curve’ option
without data-points. Fill in the next couple of menus, putting in appropriate axis
labels and titles, then insert it ‘as Object in Sheet 1’. Re-scale it so it fits the
screen nicely. You can then edit the appearance of the chart by clicking on the
axes, title or data, to make it look acceptable. Give the chart an appropriate title
which includes your name, e.g. ‘Sine Graph - Your Name’. Make sure the axes
are labelled correctly.

NOW SAVE YOUR WORK

Click on File than Save As, or the  icon. Enter a filename that includes most of
your name.

REMEMBER TO SAVE YOUR WORK EVERY 20 MINUTES OR SO, IN CASE


THERE ARE PROBLEMS: LIKE A POWER CUT, FIRE DRILL, ETC.

Exercise 2: Log Table

The next exercise is to make a log table (natural log, i.e. ln(x)) of the values in
column A, and to familiarise yourself with these manipulations. There are many
short-cut keys you might like to use rather than dragging down to copy. The
contents of C1 can be copied using Edit then Copy, or clicking on the icon, or by
using CTRL+C. By highlighting the rest of column C the cell can be filled by pasting

2
using Edit then Paste, or clicking on the icon, or by using CTRL+V. The
contents of a cell can be removed by pressing Delete. A bigger mistake can be
“Undone” by clicking on Edit then Undo, or by using CTRL+Z. Use the LN() function
to make the logs. Plot a graph as before, and ensure it has proper titles and axis
labels.

NOW SAVE YOUR WORK AGAIN 

Exercise 3: Boltzmann Distributions for Gases

DO THIS NEXT EXERCISE ON SHEET 2 (Buttons at the bottom of the page).

In this exercise we will need to do some simple arithmetic which uses the symbols +,
-, *, / and ^ (raise to the power). BE CAREFUL a/b/c is recursive, i.e. it means
a(b*c) a/b*c means (a*c)/b. Always USE BRACKETS if you are unsure. When
converting an algebraic expression into a spreadsheet entry, you must use one of
the arithmetic symbols between all variables, e.g. 3(a+b) must be written explicitly
as: 3*(a+b). If you are entering either a cell reference (e.g. A1) or a number it must
ALWAYS be prefaced by one of these symbols. If it is the first part of an equation
this should have an = sign in front as before. For example +a1/5 will give the result
0.5, but a1/5 will remain as text. If you want to delete all the contents of a cell, click
on it and then press Delete on the keyboard.

Using this information try to create a graph for the distribution of velocities in N2 gas
using the Maxwell Boltzmann Equation. F(v) is the probability that a particle has a
velocity v (see Atkins), M is the molar mass (IN SI UNITS!!) and R and T have their
usual meanings.
3/ 2
 M   − Mv 2 
F (v ) = 4π  v 2 exp 
 2 RT 

 2πRT   
As described above USE BRACKETS CAREFULLY. Some helpful pointers before
you start: π can be entered as pi(), the exponential function is exp(number to be
converted) and 5 squared is entered as 5^2.

1. Choose values of v between 0 and 1200 m s-1 and create a table of values with
an increment say of 20 as before. Label the column ‘velocity’ and put the
velocities in cells A2 to A61. Put the equation in cell B2 with values for all the
constants as appropriate, except velocity which should be typed in as the cell
reference A2. Create all the values in column B by copying and pasting. The
value in cell B2 should be about 1.2e-5 depending on your chosen temperature.
2. Now plot a graph. Set up the axes labels, titles, etc. Deduce what is the most
probable velocity at room temperature? Put the answer in an appropriate cell
with a label.

Exercise 4: Comparing Nitrogen with other Gases

If you managed that, then it is nice to be able to recalculate the formula (without
typing it all in again) automatically for other gases. So it would be useful to be able
just to change one cell and then it would be automatically recalculated. This can be
done by using fixed cells.

3
1. Go to E1. Type in 0.028.
2. We now want to replace 0.028 (in the equation in cell B2) with a reference to cell
E1, BUT we need to fix the cell reference so that when the contents of the column
are copied they do not increment the cell number. To do this enter E$1 (not E1)
in place of 0.028. Also change A2 to $A2. This is so that we can copy from
column B to C and D without changing the reference to the velocities in column A.
Now copy these changes into the rest of column B.
3. Copy column B into columns C and D.
4. Now create two new entries for the masses of He and CO2 in cells F1 and G1.
The columns should update for values of probability for He and CO2.
5. Add these to your current graph by selecting the graph window (right-click) and
then choosing ‘Source Data’ and selecting all the appropriate columns of data.
6. Label each data series with a legend by clicking on the graph and over-typing
‘series 1’ etc, with your label.
7. Give the most probable velocities of He and CO2. Remember units! Also, make
sure your graph is properly labelled.

SAVE YOUR SPREADSHEET AGAIN NOW 

Exercise 5: Fitting Experimental Data

Do this on Sheet 3. The sheets may be labelled by double clicking on the


tabs.

Using a table of values from an experiment, find the best straight line.
1. Type the following experimental values for rate constant as a function of
temperature:

T/K k / s-1 T/K k / s-1


200 284 500 9910
250 612 550 11200
300 2910 600 11500
350 3210 650 15700
400 3140 700 15900
450 8900 750 20100

2. Plot the data using the Arrhenius equation k = Ae-E/RT in a linear form (i.e. you
cannot just plot k against T).

3.Use the regression analysis to obtain the slope and intercept. This can be done
as follows:
Click on any of the data points to select them, then right-click to bring up the
menu. Choose ‘Add Trendline…’, and click on the straight line option. Then click
on ‘Options’ and choose ‘Display Equation on Chart’, then press OK. The
trendline and equation in the form y = mx + c is added to your graph. From this,
calculate the values of Ea and A and add these to your spreadsheet in a new box
(with correct units!). Make sure your graph is properly labelled, with the correct
units on the axes.

SAVE YOUR SPREADSHEET AGAIN NOW 

4
Exercise 6: Simulating an NMR Spectrum

Do this on Sheet 4 (you will need to add a new


worksheet - Insert, Worksheet)

In this section we use a spreadsheet to simulate


an NMR spectrum. Each peak can be given:
 a width, w, in ppm (which simulates the
resolution of the NMR machine),
 a number of protons N (which determines
the height of the peak)
 and a chemical_shift, δ, in ppm (which
determines its offset from 0)..

1. Create an X scale -1 to +10 (Xppm) in 0.1 steps in the first column of the
spreadsheet.
(Note: In an actual NMR spectrum the scale is written with increasing shift going
from left to right - but this is too tricky for this exercise).
2. Choose a width, say w = 0.1 ppm.
3. First, simulate the NMR spectrum of tetramethyl silane (TMS), which has a 12
protons (N = 12) and a chemical shift of δ = 0 ppm. To do this use the formula to
generate a peak lineshape:

Intensity = N w2 (1 / (w2 + (δ – Xppm)2))


to calculate the ‘Intensity’ data in the second column, and then plot these 2
columns as an XY-Plot.
4. Next, add spectra to the same plot to simulate a 1:1:1 mixture of benzene, water
and TMS. Take the chemical shifts of the protons in benzene and water to be
δ = 7 and 4, respectively. You will also need to change the number of protons, N,
for each molecule. (NOTE: because benzene, water and TMS only have 1 proton
environment each, there is no coupling and so we just see 1 peak per molecule).

1. SAVE YOUR SPREADSHEET AGAIN NOW.


2. CLOSE DOWN THE EXCEL PROGRAM.
3. UPLOAD YOUR SPREADSHEET TO THE ONLINE WEB SYSTEM. THE
MEMBER OF STAFF IN CHARGE OF YOUR WORKSHOP WILL MARK IT
AND PUT THE MARKS AND COMMENTS ONTO THE WEB.

Anda mungkin juga menyukai