  Magnetocrystalline anisotropy, the microscopic origin of permanent magnetism,
is often explained in terms of ferromagnets. However, the best performing
permanent magnets based on rare earths and transition metals (RE-TM) are in
fact ferrimagnets, consisting of a number of magnetic sublattices. Here we show
how a naive calculation of the magnetocrystalline anisotropy of the classic
RE-TM ferrimagnet GdCo$_5$ gives numbers which are too large at 0 K and exhibit
the wrong temperature dependence. We solve this problem by introducing a
first-principles approach to calculate temperature-dependent magnetization vs.
field (FPMVB) curves, mirroring the experiments actually used to determine the
anisotropy. We pair our calculations with measurements on a recently-grown
single crystal of GdCo$_5$, and find excellent agreement. The FPMVB approach
demonstrates a new level of sophistication in the use of first-principles
calculations to understand RE-TM magnets.
