The Ram-Yip formula for Macdonald polynomials (at t=0) provides a statistic
which we call charge. In types A and C it can be defined on tensor products of
Kashiwara-Nakashima single column crystals. In this paper we prove that the
charge is equal to the (negative of the) energy function on affine crystals.
The algorithm for computing charge is much simpler and can be more efficiently
computed than the recursive definition of energy in terms of the combinatorial
R-matrix.Comment: 25 pages; 1 figur