Exercise #1

In chemistry, the molar refraction of an organic compound is an approximate measure of the total volume (without free space) of the molecules in one mole of the compound. (A mole is a fixed number of molecules. The number is Avogadro's number, 6.022 · 1023, which is the ratio between one gram and one atomic mass unit.)

The molar refraction can be computed from the compound's molecular weight (the weight of one molecule, in atomic mass units), its density (in grams per cubic centimeter), and its index of refraction (the ratio between the speed of light in a vacuum and the speed of light through the compound). Specifically, if M is the molecular weight, d is the density, and n is the index of refraction, then the molar refraction R is equal to

((n2 - 1) / (n2 + 2)) · (M / d).

Define and test a Scheme procedure that computes a compound's molar refraction, given its molecular weight, density, and index of refraction. Here are some data to use in testing your procedure, taken from the CRC Handbook of Chemistry and Physics (first student edition), from the public ChemExper database, and from U.S. Peroxide's ``Introduction to hydrogen peroxide: radiation properties''.

I encourage you to include additional test runs if they demonstrate surprising or elegant features of your program or document its limitations.

See the handout on submitting solutions by e-mail for step-by-step instructions on how to turn it your program and a transcript of the test runs.

This exercise will be due at 9 a.m. on Tuesday, January 27.


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~stone/courses/scheme/exercises/1.xhtml

Validated as XHTML 1.1 by the World Wide Web Consortium Cascading Style Sheet validated by the World Wide Web Consortium

created January 22, 2004
last revised January 23, 2004

John David Stone (stone@cs.grinnell.edu)