Note: This article was scanned using OCR from the Fall 1986 CCCE Newsletter. Please contact us if you identify any OCR errors.
In the June 1986 issue of this Newsletter I described a program which has been used by students in lecture and laboratory courses to solve the equation f(x) = o. Complicated equations of this form are easily developed even in a general chemistry course.
Paul Cauchon wrote to say that his secondary school students at Canterbury School write such a program. Alfred J. Lata at the University of Kansas has demonstrated Ken Ratzlaff's program which graphically helps to locate roots.
One of the commercial software exhibitors at the Biennial Meeting in Bozeman last summer saw my article and wrote to say that it makes much more sense to use sophisticated commercial software rather than trying to develop programs of your own. Many programmers have spent long hours developing programs where satisfactory or better commercial programs already exist. However, since all students at Clarkson have their own computers, a program is needed which can be distributed to all students. Students have to buy books for courses. Is it reasonable to ask them to spend $10 or more for a single program which they will only use a few times in a course? Usually, site licenses are very expensive. If students in computer programming courses are asked to write programs which will be used in other courses, this can have a very positive influence on student attitudes.
If any readers have additional thoughts on this or related subjects, please write.
In this issue, I'd like to consider the development and use of a program which will solve quadratic equations. Such a program is of possible use when the hydrogen ion concentration of a weak acid, HA, needs to be calculated or equilibrium involving a complex, MX, needs to be considered. such problems are considered even in general chemistry courses. If the quadratic equation is written as:
AX2 + BX + C = 0
everyone knows from high school algebra that
X= -B + (or -) SOR (B2 - 4ACl)
2A
This is a correct formula, but computers perform arithmetic with finite accuracy. In some cases large round off errors can occur. One situation where this can be true is when B*B is very much larger than 4AC. Under hese circumstances, the value of the square root term in the above equation will be close to B. If the -B term and the square root term have opposite signs the computer can give an erroneous result. However, the root having the larger absolute value (-B and square root terms have the same sign) can be calculated quite accurately. The trick is to calculate the larger absolute value root, Rl, and the other root, R2 is C/(A*Rl).
To illustrate a situation in which the two formulas give different results, consider a complex MX whose dissociation constant is 1 (A= B = 1). If the initial concentration of complex is lE-7 (C = - lE-7), the quadratic formula gives 5.96E-8 on my microcomputer and C/(A*Rl) is lE-7. If the initial concentration of complex is lE-8 (C = -lE-8), the quadratic formula gives 0 on my microcomputer and C/(A*Rl) is lE-8. (Rl = -1 in both cases.) These results indicate the complex is virtually completely dissociated. The concentration of undissociated complex is lE-14 in the first case and lE-16 in the second case.
* Department of Chemistry
Clarkson University
Potsdam, NY 13676