For the Casimir effect with exponential regularization, we compute the vacuum energy between the plates (somewhat simplified) with: $$\omega = c\ \sqrt{q^2+k_z^2}$$ $$ E = \sum_{k_z=n\pi/a} 2 \int\limits_0^\infty\frac{q\,dq}{2\pi} \ \frac{{\small \hbar}}{\small 2} \ \omega\ e^{-\omega/C} $$ In Mathematica, ignoring some constant factors, we first do the integral and then the sum:

    w = c Sqrt[kz^2+q^2]
    Int = Integrate[q/2/Pi w Exp[-w/C], {q,0,Infinity}, Assumptions->{C>0,c>0,kz>0}]
      (*  Result: c kz^3 ExpIntegralE[-2, (c*kz)/C] / (2Pi)  *)
    Ecas = Sum[ Int /.kz->Pi/a n, {n,1,Infinity}]
      (*  Fails to find a result! Try re-expressing Int:  *)
    altInt = C^3/(2Pi c^2) Gamma[3, kz c/C]
      (*  returns True  *)
    Ecas = Sum[ altInt/.kz->Pi/a n, {n,1,Infinity}]
      (*  Now the result is found!  *)
    Series[Ecas, {C,Infinity,0}]

              4      3          2
         3 a C      C       c Pi      1
Out[11]= ------ - ------- - ------ + ----
          3   2      2           3   O[C]
         c  Pi    2 c  Pi   720 a

The integral results in c*kz^3*ExpIntegralE[-2, (c*kz)/C]/(2*Pi). Unfortunately, this gives failure to compute the subsequent sum Ecas = Sum[ Int /.kz->Pi/a n, {n,1,Infinity}].

The integral could have been expressed using an incomplete $\Gamma$ function: altInt = C^3/(2Pi c^2) Gamma[3, kz c/C] (check FullSimplify[altInt==Int] gives True!) In that case Mathematica does find the sum: Ecas = Sum[ altInt/.kz->Pi/a n, {n,1,Infinity}] and with cutoff parameter $C \rightarrow \infty$ in Series[Ecas, {C,Infinity,0}] it then correctly shows the well-known term $-c\pi^2/(720\,a^3),$ describing the Casimir effect.

So it is unfortunate that Mathematica did not choose to express the integral as a gamma function... Strangely, if we leave out the assumptions for the integral, we do get a conditional expression, but it does in that case choose the gamma function. Also, if we give Assumptions->{C>0,c>0} but leave out the kz>0, then we even get the gamma function without the conditional expression! So questions are:

  1. Why does Mathematica solve this problem with less assumptions and fails with more help by an extra assumption?
  2. Why does the choice of how to express the integral depend on the details of the given assumptions along the way? In the end both expressions are exactly the same.
  3. Why does the sum fail for the expression with ExpIntegralE even though it is exactly equal to the expression with Gamma for which the sum can be evaluated?

PS: (edited) thanks to the comments and answers we have now established that 1) using FunctionExpand on the integral result solves the problem, the subsequent sum then works, and 2) that the result of the integral is then even simpler than the two alternatives we had, neither ExpIntegralE nor Gamma is needed! So we now have three different ways to express the integral. Using $c=1$ for clarity, so $\omega = \sqrt{q^2+k_z^2}$, the three expressions are: $$ \int \frac{q\ dq}{2\pi} \ \omega\ e^{-\omega/C} = \frac{C^3}{2\pi}\ \Gamma\big(3, \frac{k_z}C\big) = $$ $$ = \frac{k_z^3}{2\pi} E_{-2}\big(\frac{k_z}{C}\big) \ = \left(C^3+C^2 k_z + C k_z^2/2\right) \ e^{-k_z/C} $$

  • 1
    $\begingroup$ Can you provide fully-functional code? For example, Int as written evaluates to the wrong thing because I don't have a definition of w, and when I tried to put it in I got that Int, is C^2 Γ[3, kz/C]/2π, since I let c=1. So it's tricky reproduce your exact issue. Orthogonally, typically when studying the Casimir effect the energy is divergent in a regulator-dependent way but the force is finite. So you might be better off differentiating before summing. $\endgroup$
    – evanb
    Feb 25 at 13:32
  • 1
    $\begingroup$ Here we see the shadow effect. C is a system symbol. So it could be better to use c1 instead of C. The transition Series[Ecas, {C,Infinity,0}] you are making is incorrect. It's just a miracle that you got some results there. In the future, when you evaluate such expressions, try to minimize the number of constants used. $\endgroup$ Feb 25 at 14:54
  • $\begingroup$ @evanb Sorry for the omission, I now added it (I got lot's of "not submitted, wrong code formatting" when I tried to submit the question and then it got lost... Apologies from a newbe!) $\endgroup$ Feb 25 at 15:28
  • $\begingroup$ @Alex I see no difference when I rename C to Coff, I still get the ExpIntegralE. (And actually I didn't know C was a system variable, I wouldn't use E or N, but C looked innocent and it is closest to what we physicists use for "cutoff". I do see the difference when I replace "c" by 1, but that just re-iterates the question: why is the function chosen by Integrate so dependent on these little details? $\endgroup$ Feb 25 at 15:40
  • 1
    $\begingroup$ @JosBergervoet Please see tutorial C[i] is the default form for the i\[Null]\[Null]^th parameter or constant generated in representing the results of various symbolic computations. $\endgroup$ Feb 25 at 17:13

1 Answer 1


(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)


w = c  Sqrt[kz^2 + q^2];

Use FunctionExpand

Int = Assuming[{Coff > 0, c > 0, kz > 0},
  Integrate[q/2/Pi  w  Exp[-w/Coff], {q, 0, Infinity}] // 
   FunctionExpand // Simplify]

(* (Coff E^(-((c kz)/Coff)) (2 Coff^2 + 2 c Coff kz + c^2 kz^2))/(2 c^2 π) *)

This is equivalent to your alternate representation.

Int == Coff^3/(2 Pi  c^2)  Gamma[3, kz  c/Coff] // FullSimplify

(* True *)

The summation is

Ecas = Sum[Int /. kz -> Pi/a  n, {n, 1, Infinity}] //

(* (2 a^2 Coff^3 - 
   Coff E^((c π)/(
    a Coff)) (4 a^2 Coff^2 + 2 a c Coff π - c^2 π^2) + 
   Coff E^((2 c π)/(
    a Coff)) (2 a^2 Coff^2 + 2 a c Coff π + c^2 π^2))/(2 a^2 c^2 (-1 +
      E^((c π)/(a Coff)))^3 π) *)
  • 1
    $\begingroup$ Indeed FunctionExpand does the job, as a bonus it even shows us that the expression does not need any special functions at all! I think we here have found the simplest "demonstration calculation" of the Casimir effect. $\endgroup$ Feb 25 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.