8—Multivariable Calculus 232
of several variables subject to constraints on N and on E. Now all you have to do is to figure out out to
differentiate with respect to integers. Answer: IfNis large you will be able to treat these variables as continuous
and to use standard calculus to manipulate them.
For largen, recall Stirling’s formula, Eq. (2.15),
n!∼
√
2 πnnne−n or its log: ln(n!)∼ln
√
2 πn+nlnn−n (24)
This, I can differentiate. Maximizing ( 23 ) is the same as maximizing its logarithm, and that’s easier to work with.
maximizef= ln(N!)−ln(n 1 !)−ln(n 2 !)−ln(n 3 !)
subject ton 1 +n 2 +n 3 =N and n 1 E 1 +n 2 E 2 +n 3 E 3 =E
There are two constraints here, so there are two Lagrange multipliers.
∇
(
f−λ 1 (n 1 +n 2 +n 3 −N)−λ 2 (n 1 E 1 +n 2 E 2 +n 3 E 3 −E)
)
= 0
Forf, use Stirling’s approximation, but not quite. The termln
√
2 πnis negligible. Fornas small as 106 , it is
about 6 × 10 −^7 of the whole. Logarithms are much smaller than powers. That means that I can use
∇
( 3
∑
`=1
(
−n`ln(n`) +n`
)
−λ 1 n`−λ 2 n`E`
)
= 0
This is easier than it looks because each derivative involves only one coordinate.
∂
∂n 1
→−lnn 1 −1 + 1−λ 1 −λ 2 E 1 = 0, etc.
This is
n=e−λ^1 −λ^2 E
, `= 1, 2 , 3
There are two unknowns here,λ 1 andλ 2. There are two equations, forN andE. The parameterλ 1 simply
determines an overall constant,e−λ^1 =C.
C
∑^3
`=1
e−λ^2 E`=N, and C
∑^3
`=1
E`e−λ^2 E`=E