The Hamiltonian density is . In the vacuum only contributes. Hence
Substitution, using , yields
This Dirichlet scalar vacuum energy density illustrates why a massive field's local unregularized energy density need not be uniform. The cosine integrates to zero over the interval, so
These divergent expressions are understood with a common regulator before exchanging sums, integrals or derivatives. Normal ordering the Hamiltonian operator separately in each geometry would erase the vacuum terms one is trying to compare; a common regulated subtraction is used instead in c and d.