Rapidly oscillating piston -- work or heat? Question
An ideal gas has its volume controlled by the $x$-coordinate of a piston.  At $t=0$, the piston starts oscillating very quickly (compared to the time scale of equilibration in the gas), then after some time it stops at its original $x$-coordinate.  Once the gas comes to equilibrium again, it will have the same volume as at $t=0$, but its energy will have increased (due to sound waves produced by the piston).  Is this change in energy considered work, or heat?
Assume that the gas and piston are insulated in such a way that the final energy of the gas is independent of the temperature of the piston/surroundings. 
Discussion


*

*If I understand it correctly, the following are the usual definitions of work and heat:



Work: Some parameters of the system's Hamiltonian are declared to be "external parameters," and work is a change in the system's energy
  due to a change in one or more external parameters.
Heat: Any change in the system's energy that is not due to work.



*

*It seems to me that since the volume is an external parameter, the oscillating piston does work on the gas even though there is no net change in volume.

*If instead you answer heat, then my follow-up is: repeat the above experiment with  a final volume smaller than the initial volume (ie, the piston compresses the gas while oscillating rapidly).  The gas again gains energy -- do you call this heat, or do you have a way to separate the change in energy into a "work" term and a "heat" term?  What if the piston does not oscillate but simply compresses the gas very quickly, again producing sound waves that increase the final equilibrium energy of the gas?
 A: Work is not a state variable. As such, the total change in volume is not what determines the work done on the system. Rather, the work $W$ is given by 
$$ W = \int_{\text{initial state}}^{\text{final state}} p\; dV $$
Where $p$ is the pressure and $V$ is the volume. Since the piston is moved quickly and non-reversibly the work done is nonzero -- the internal energy gained by the gas is from the work done by the piston. 
A: Energy transfer due to temperature difference is called heat transfer. Everything else is called work (assuming there is no mass transfer etc.). In your example it would be proper to say that energy of system increases due to work done on it. 
Change in volume is not necessary for using the term "work done"; consider for example, paddle work.
A: I'll concentrate for this question on the energy that has been converted to sound, rather than dissipative losses, which are obviously heat.
In this case, the answer is mostly work, at least initially, but it becomes heat as the sound is absorbed.
I don't believe there is in general a binary, "yes/no" or "heat/work" answer to this kind of energy conversion question - one needs instead to quantify ion a continuum how "heaty" or "worky" the added energy is and one does this through calculation of the change in entropy of the system that the energy in question is added to that arises from the addition of this energy.
In the case of sound, the additional energy is stored in well-defined oscillatory components of motion of the gas molecules. Sure, the molecules themselves have highly randomized motions, but the sound represents a well defined average additional motion that is precisely quantified by e.g. the solution of the relevant wave equation that tells you the vector velocities of the changes in motion of the molecules as a function of position and time. So one requires very little knowledge / information to describe how the states of motions of the molecules have changed - that is, the energy addition has wrought very little entropy change in the system. 
However, as the wave propagates through the gas, the motion represented by additional kinetic energy becomes less "co-ordinated" as this additional kinetic energy contributes less to the co-ordinated, wave-equation-governed motion and is converted into randomized (thermalized) motion. The sound has dissipated, the distribution of molecular motions has returned to being described wholly by the Boltzmann distribution but with a slightly higher temperature than before.
The above illustrates the obvious quantification  of "workiness / heatiness" as follows. Let a small amount $\mathrm{d}E$ of the energy be added to the system. Let the entropy change be $\mathrm{d}S$, and the system's initial temperature be $T$. Then the heat added is $\mathrm{d} Q = T\,\mathrm{d} S$: that part of the energy that goes into thermalized motion. The leftover is of course the work done on the system: it's the part whose addition brings about a change in the system microstate than can be precisely described (in this case through the relevant wave equation solution):
$$\mathrm{d} W = \mathrm{d} E - T\,\mathrm{d} S$$
Of course, entropy is not easily measured like energy and temperature, so this is mostly a way to define working on and heating of a system. 
