What is the deal with heat capacity? For some time now I've been confused about heat capacity. The way I understand it, if I put in an amount of heat energy into the system, $dQ$, its temperature will change by $CdT$. But now,  everywhere I look I only find $C_p$ and $C_V$, the heat capacities in isobaric/isochoric processes. But for an arbitrary process, how do I calculate its heat capacity, in other words how do I find $$\frac{\partial Q}{ \partial T}, \mbox{ with } p=p(V)$$
where $p=p(V)$ is the equation of this process.
My question: I wish to calculate the heat capacity in a polytropic process with exponent $n$, so the equation is $pV^n=const$, and so $p=\frac{p_1 V_1 ^n}{V^n}$.
How do I get from here to actually calculating the heat capacity, that is the partial derivative?
P.S. I apologize if I'm mixing or misunderstanding notions here, but the way I was taught thermodynamics was horrible, just learning how to solve particular problem types without understanding the physics of it at all, and I hadn't yet had time to look for some source to correct all these misconceptions. Would be greatful if someone could recommend a mathematically rigorous text on thermodynamics that doesn't make unexplained simplifications and helps intuitively grasp the physics of it.
 A: Let's start by computing heat capacities in a context that is a bit more general than polytropic processes; those defined by the constancy of some state variable $X$.
For concreteness, let's assume we are considering a thermodynamic system, like an ideal gas, whose state can be characterized by its temperature, pressure, and volume $(T,P,V)$ and for which the first law of thermodynamics reads
\begin{align}
  dE = \delta Q - PdV
\end{align}
We further assume that there exists some equation of state which relates $T$, $V$, and $P$ so that the state of the system can in fact be specified by any two of these variables.  Suppose that we want to determine the heat capacity of the system for a quasistatic process (curve in thermodynamic state space) for which some quantity $X=X(P,V)$ is kept constant.  The trick is to first note that every state variable can be written (at least locally in sufficiently non-pathological cases), as a function of $T$ and $X$.  Then the first law can be written as follows:
\begin{align}
  \delta Q 
  &= dE + PdV \\
  &= \left[\left(\frac{\partial E}{\partial T}\right)_{X}+P\left(\frac{\partial V}{\partial T}\right)_{X}\right]dT + \left[\left(\frac{\partial E}{\partial X}\right)_{T}+P\left(\frac{\partial V}{\partial X}\right)_{T}\right]dX
\end{align}
Now, we see that if we keep the quantity $X$ constant along the path, then $\delta Q$ is proportional to $dT$, and the proportionality function is (by definition) the heat capacity for a process at constant $X$;
\begin{align}
  C_X = \left(\frac{\partial E}{\partial T}\right)_{X}+P\left(\frac{\partial V}{\partial T}\right)_{X}
\end{align}
Now, if you want an explicit expression for this heat capacity, then you simply need to determine the energy, pressure, and volume functions of $T$ and $X$ and then take the appropriate derivatives.
Consider, for example, a polytropic process like you originally described, and further, consider a monatomic ideal gas for which the energy and equation of state can be written as follows:
\begin{align}
  E = \frac{3}{2} NkT, \qquad PV = NkT
\end{align}
For this process, we have
\begin{align}
  X = PV^n
\end{align}
Using the equation of state and the definition of $X$, we obtain
\begin{align}
  V = (NkT)^{1/(1-n)}X^{1/(n-1)}, \qquad P = (NkT)^{n/(n-1)}X^{1/(1-n)}
\end{align}
and now you can take the required derivatives in to obtain $C_X$ where $X$ is appropriate for an arbitrary polytropic process.
Moral of the story. If the system you care about can be written as a function of only two state variables, write all quantities in terms of $T$ and $X$, the variable you want to keep constant.  Then, the first law takes the form $\delta Q = \mathrm{stuff}\,dT + \mathrm{stuff}\,dX$ and the $\mathrm{stuff}$ in front of $dT$ is, by definition, the desired heat capacity.
A: Heat capacity depends on path.  $C_V$ is the heat capacity along a constant volume path while $C_p$ is measured along a constant pressure path.  Those are easy to measure.  Some are simple:  the heat capacity along an adiabatic path is zero since no heat can enter or leave the system.  Heat capacity along an isothermal path is infinite since you can add all the heat you want to the system without changing the temperature.
So each different path has its own heat capacity.  Some even have negative heat capacities.
What you have to do to find the heat capacity for an arbitrary path is to find a way to express $Q$ in thermodynamic variables along that path.  Once you do that $C = \partial Q/\partial T$.
A: There are simple formulae which allow one to compute the heat capacities $C_p$ and $C_V$ for any Gibbsian substance whose equations of state are given in the form $$T=f(p,V), \quad S=g(p,V)$$ for suitable functions $f$ and $g$ of the two variables $p$ and $V$ in a unified manner.  They are $$C_V=\frac {fg_p}{f_p},\quad C_p=\frac {fg_V}{f_V}$$
where subscripts denote partial derivatives with respect to the variables.  Thus for the ideal gas where $f(p,V)=p V$ and $g(p,V)=\frac 1 {\gamma-1}\ln(p V^\gamma)$ we have $f_p=V$, $f_V=p$, $g_p=\frac 1{(\gamma-1)p}$ and $g_V=\frac \gamma{(\gamma-1)V}$
which lead to the familiar formulae (we have ignored physical constants in order to simplify the formulation).  The advantage of this approach is that it can be used in principle for any gas (e.g., the van der Waals gas or the Feynman gas) and similar formulae hold for the more elaborate thermodynamical quantitities that arise. It also shows that one cannot hope to compute the heat capacities from the first equation of state (temperature as a function of $p$ and $V$) but requires information about entropy also.  Curiously, this is not true for the important quantity $C_p-C_V$ which is just $\frac f{f_pf_V}$.These formulae are obtained by simple manipulations involving  the chain rule and inverse function theorem (details in the arXiv paper 1102.1540).
