The Validity of Stirling's Approximation: A Physical Chemistry Project

Oct 10, 1999 - Department of Computer Science, Mathematics, and Physics, Missouri Western State College, St. Joseph, MO 64507. An educator's goal is t...
3 downloads 8 Views 59KB Size
In the Classroom

The Validity of Stirling’s Approximation A Physical Chemistry Project A. S. Wallner Department of Chemistry, Missouri Western State College, St. Joseph, MO 64507; [email protected] K. A. Brandt Department of Computer Science, Mathematics, and Physics, Missouri Western State College, St. Joseph, MO 64507

An educator’s goal is to present course material in an interesting and relevant context. In physical chemistry class, bringing some real world examples into the course, showing relevance to the students, making connections to other material in the course or to material in other courses, and using current computer technology are vital to improve comprehension and mastery of important physical chemistry concepts (1). This paper deals with the development and use of Stirling’s approximation in the area of statistical mechanics. The paper is divided into three sections. The first deals with the development of the initial question about Stirling’s approximation. This came about from our class discussions surrounding statistical thermodynamics. Reports in the literature have shown that the use of Stirling’s approximation is often quoted but rarely proved and is invariably accepted on trust. The method and result demand a level of mathematics unattainable by most undergraduates (2, 3). The second section provides an elementary proof of Stirling’s approximation that is accessible to undergraduate students who have had the basic calculus sequence. The third section provides the directions and example solutions for a physical chemistry project that verifies the validity of Stirling’s approximation.

ln(n!) ≅ n ln n – n

ln W = N ln N – Σ n i ln n i i

(1)

where N is the total number of objects and the n0!n1!n2!… terms are the number of objects in each orientation. The solution is 1.26 × 104 possible configurations for this system. Of course, in real chemical systems, we never deal with numbers as small as 10. Next, we want to apply the equation to a more applicable system, let us say Avogadro’s number of objects. With the tools available to students, this becomes a difficult problem (most calculators will only calculate factorials as high as 69). We then apply Stirling’s approximation to simplify the equation and calculate the solution for large

(3)

This form of the equation allows students to calculate answers more easily for problems on the order of Avogadro’s number. Mathematics of Stirling’s Approximation In this section, we discuss two theorems attributed to the Scottish mathematician James Stirling (1692–1770). Stirling studied factorials in his book Methodus Differentialis (5), published in 1730. These results are well known, but they are not typically presented in standard calculus texts such as those by Thomas and Finney (6 ) and Edwards and Penney (7). Stirling’s formula states that lim

This paper is a result of class discussions on statistical thermodynamic concepts. Concepts such as distinguishable particles, accessibility and energy of states, and the equations of statistical mechanics and their derivations were all introduced. The statistical concept of the weight, the number of ways in which these distinguishable particles may be chosen, was used to calculate the number of possible configurations that can be created. To give the students a more concrete example, the equation was introduced with the problem of 10 distinguishable balls being distributed into 4 identical bags, each bag containing the distribution {4,3,2,1}. The equation used is

(2)

This form is supplied, for example, in Atkins’s Physical Chemistry (4 ). By applying Stirling’s approximation eq 2 to eq 1, the weight equation can be written as

n→∞

Development of Project

W = N !/n0!n1!n2!…

values of N. A useful form of Stirling’s approximation comes from the equation

n! =1 2πn n n e {n

(4)

Thus for n sufficiently large,

n! ≅ 2πn n n e {n

(5)

The proof is quite technical (see Apostol [8] or Courant [9]). Since the values of n! are very large even for relatively small values of n, it is often more convenient to work with ln(n!). Stirling’s approximation states that

lim

n→∞ n

ln n! =1 ln n – n

(6)

Thus for n sufficiently large, ln(n!) ≅ n ln n – n. Stirling’s approximation can be derived from Stirling’s formula, although this derivation requires some technical justification that students may not appreciate. There is, however, a simple and direct proof of Stirling’s approximation that makes no mention of Stirling’s formula. This proof is not included in standard calculus texts, so we present it here. An intuitive derivation is given by McQuarrie (10); our proof uses a similar approach but is more rigorous. Whenever a result can be easily justified, it is important to share the details with students. We encourage instructors to present the proof below or assign it as an exercise (with appropriate hints). The proof follows

JChemEd.chem.wisc.edu • Vol. 76 No. 10 October 1999 • Journal of Chemical Education

1395

In the Classroom

an approach used by Courant (9) to prove Stirling’s formula but requires only a few tools from first-year calculus. First recall that integration by parts can be used to show that ∫ ln x dx = x ln x – x. Also, by properties of logarithms, ln(n!) = ln 2 + ln 3 + … + ln n. By constructing rectangles above and below the graph of y = ln x (Fig. 1) and comparing the area under the curve with the total area of the rectangles, we can show that n

n+1

ln x dx ≤ ln n! ≤

1

ln x dx 2

Note that in both parts of the figure, the rectangles have area ln 2, ln 3, …, ln n. Thus the total area of the rectangles is ln 2 + ln 3 + … + ln n = ln(n!). After evaluating the integrals and dividing by n ln n – n, we obtain ln n! n + 1 ln n + 1 – n + 1 – 2 ln 2 n ln n – n – 1 ≤ ≤ n ln n – n n ln n – n n ln n – n

It is easy to show using L’Hopital’s rule that the expressions on the left and right ends both tend to 1 as n → ∞. Thus by the sandwich theorem, Stirling’s approximation is established. Student Project In the first year of teaching statistical thermodynamics, the students seemed to grasp the concept of eq 1, and we continued with the course material. The second year an interesting thing happened. As we covered this area, a student went back to the 10-ball example and applied eq 3 to it. The solution using the approximation was vastly different from the solution using the exact formula. The question came up in class, “When is Stirling’s approximation valid?” According to Physical Chemistry, Stirling’s formula, eq 5, should be reasonably useful for values around 10 (4), but it says nothing about the validity of eq 2. The project for the students became to demonstrate numerically the validity of Stirling’s approximation. They needed to address several questions. What does valid mean? What are acceptable margins of errors in calculations and experiments? What method(s) could they use to prove their point? Why is this important? What does the term authority mean and should they question that?

The solutions that were obtained are grouped below into several broad categories. These solutions used programmable calculators, commercially available computer programs, and simple student-written computer programs to provide evidence for the acceptable range of validity. In class, the students are provided with the proof of Stirling’s approximation as shown in the previous section to give eq 2. The students provided the following solutions for the project. Most students came up with 1% error as being acceptable for Stirling’s formula, eq 4, and the approximation, eq 6. The arguments usually compared the errors in measurement in the laboratory, which are larger than this value. Therefore, the “approximation error” will not affect your final results greatly. Since all the students have taken our three-semester calculus sequence, they all have a programmable calculator. They easily wrote a small program on their calculator which 1396

evaluated eq 4 and the approximation, eq 6, at various values of n. At n = 69 the error in both equations was on the order of 1% (perhaps another contributing factor for the students choice of 1% as their acceptable error limit). The calculator cannot calculate anything greater than 69!. Some students used a commercially available software program, Derive (11), to solve their problem. The setup was similar to the calculator example but allowed for comparison of the two equations up to a value of n = 4000. Table 1 shows selected outputs from the expressions in both eqs 4 and 6. Other students wrote a simple computer program by substituting the value of ln n! by the sum of ln 2 + ln 3 + ln 4 + … + ln n. Using a program with a loop, all the values can be calculated and compared in a manner similar to that of the Derive solution. This allows for calculations beyond n = 4000. Conclusion This project shows the students several things. First, it provides them with an easily understood proof of a mathematical concept that is used often in statistical thermodynamics. Most books and authors have either avoided the use of Stirling’s approximation or had students take its proof on trust, believing the mathematics to be beyond the students’ abilities. Second, the project allows them to discuss the term “valid” and come up with an acceptable definition. Students’ definitions specified errors ranging from 5% to less than 1%. This range was most often determined by the method used to verify the validity. Most of the students’ argument for validity was based around acceptable errors of measurement in the lab. For example, a 1% error in approximation was acceptable,

a

b y = ln x

1

2

3

4

y = ln x

n n+1

1

2

3

4

5

n-1 n

Figure 1. (a) Rectangles constructed above the graph of y = ln x n showing that ∫1 ln x dx ≤ ln(n!). (b) Rectangles constructed below n+ the graph of y = ln x showing that ln(n!) ≤ ∫2 1 ln x dx.

Table 1. Comparison of Stirling's Formula and Stirling's Approximation

n

n! 2πn n ne {n

ln (n !) n ln n – n

10

1.008365359

1.159572042

50

1.001668034

1.019756826

100

1.000833677

1.008938154

500

1.000166680

1.001544280

1000

1.0000833336

1.000740196

2000

1.000041667

1.000357483

4000

1.000020834

1.000173634

Journal of Chemical Education • Vol. 76 No. 10 October 1999 • JChemEd.chem.wisc.edu

In the Classroom

some argued, since lab data often have errors greater than 1% associated with them. The students used a variety of methods to calculate the values in Table 1, including graphing calculators, software such as Derive, and computer programs. Most students required little or no guidance from the instructor. However, a few needed helpful hints to complete the project. The project is open-ended enough to have several solutions easily managed by students with the resources available to them on campus or through their previous academic training. Pedagogically, this exercise is useful because it emphasizes the connection between mathematics and chemistry through a challenging but workable undergraduate project. Students commented that they were initially frustrated, but eventually they felt a sense of accomplishment verifying the validity of Stirling’s approximation numerically. During a class discussion, students indicated that they were becoming more confident in their ability to question ideas as well as suggest and justify alternatives.

Acknowledgment We would like to thank Steve Klassen for his help with creating the figures for this paper. Literature Cited 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.

Atkins, P. W. Can. Chem. News 1992, 44(3), 8. Barford, N. C. Am. J. Phys. 1976, 44, 940. Wall, F. T. Proc. Natl. Acad. Sci. USA 1971, 68, 1720. Atkins, P. W. Physical Chemistry, 5th ed.; Freeman: New York, 1994. Stirling, J. Methodus Differentialis; London, 1730. Thomas, G. B.; Finney, R. L. Calculus, 9th ed.; Addison Wesley: Reading, MA, 1996. Edwards, C. H.; Penney, D. E. Calculus and Analytic Geometry, 3rd ed.; Prentice Hall: Englewood Cliffs, NJ, 1990. Apostol, T. M. Calculus, Volume II; Blaisdell: Waltham, MA, 1962. Courant, R. Differential and Integral Calculus, Vol. I, 2nd ed.; Wiley: London, 1963. McQuarrie, D. A. Statistical Mechanics; Harper Row: New York, 1976. Derive®: A Mathematical Assistant for Your Personal Computer, v 2.55; Soft Warehouse, Inc.: Honolulu, 1992.

JChemEd.chem.wisc.edu • Vol. 76 No. 10 October 1999 • Journal of Chemical Education

1397