Internal energy of an ideal gas as a function of volume Okay so I've been reading a bit on Thermodynamics and I found something that I couldn't wrap around my head. For an ideal gas, the change in internal energy is equal to
$$\Delta U = Q + W$$
And also, if the internal energy is a function of volume and temperature, we can write
$$\mathrm{d}U = \left( \frac{\partial U}{\partial V} \right)_T \mathrm{d}V + \left( \frac{\partial U}{\partial T} \right)_V \mathrm{d}T$$
Which is the same as
$$\mathrm{d}U = \pi_T \mathrm{d}V+C_V \mathrm{d}T$$
Now the book I'm reading, Atkins' Physical Chemistry, argues that $\pi_T$ is equal to zero for ideal gases. The book reasoned by using the expression $U = \frac{NfkT}{2}$, where $f$ is the number of degrees of freedom. My question is, if the internal energy of an ideal gas is independent of its volume, then how it is possible then that doing work to the system changes its internal energy? As
$$W=-\int_{V_i}^{V_f}P(V)\mathrm{d}V$$
Clearly there is a change in volume (e.g. from pushing a piston). Furthermore, the expression $U = \frac{NfkT}{2}$ can easily be converted into $U = \frac{fPV}{2}$ by invoking the ideal gas law.
Since it is claimed that the internal energy of an ideal gas is independent of its volume, the above reasoning that I came in conclusion doesn't seem to support it. I know there must be something wrong with my reasoning, but I can't figure it out. What am I doing wrong here?
 A: In addition to the other reply, it can be added that by definition, in an ideal gas, there is no interaction between molecules, and therefore no potential energy associated with the average distance. This is why in a Joule-Thomson expansion, there is no change in the temperature of the gas: only the volume changes, no work is extracted, and the average speed of the molecules is left unchanged. However, in a work-producing expansion, energy is taken from the kinetic energy of the molecules. In that case there is a drop in temperature as well.
A: The internal energy of an ideal gas is independent of volume when considered as a function of volume and temperature. If we choose to consider internal energy as a function of volume and some other thermodynamic variable we will find that the dependence of the energy on volume will change because we are keeping a different variable constant as volume is varied. 
So if we consider $U$ as a function of volume and entropy we get
$$
\mathrm{d}U = \left(\frac{\partial U}{\partial S}\right)_V \mathrm{d}S + \left(\frac{\partial U}{\partial V}\right)_S \mathrm{d}V.
$$
Now $P = \left(\frac{\partial U}{\partial V}\right)_S$ and is certainly not equal to 0.
The particular case of an ideal gas is unusual because it terns out that the internal energy is only a function of temperature. This means $\left(\frac{\partial U}{\partial X}\right)_T = 0$ for any variable $X$. If we choose our thermodynamic degrees of freedom to be variable other than $T$ however, say for concreteness $S$ and $V$ again, then we are treating $T$ as a function of $S$ and $V$ as well and so $U$ gains a dependence on $V$ and $S$ through $T$.
