Thermal energy generated by collision observed from two different frames of reference An isolated system is composed of two bodies $A$ and $B$, with masses $m_A$ and $m_B$, $m_A \ne m_B$, which are in route of collision. The relative velocity between them is $v$. The collision is inelastic and I want to calculate how much thermal energy is generated at the collision.
I understand that the thermal energy $\Delta T$ generated equals the variation of the kinetic energy, so that the total energy is conserved. I  expected $\Delta T$ to be independent of the reference frame.
However, if I consider a reference frame $S_A$ fixed in body $A$, I get the following change in kinetic energy of the system:
$$ \Delta T_A = \left( \frac{m_A 0^2}{2} + \frac{m_B v^2}{2} \right) - \left( \frac{m_A 0^2}{2} + \frac{m_B 0^2}{2} \right)  = \frac{m_B v^2}{2}.  $$
And if I consider a reference frame $S_B$ fixed in body $B$, I get a different change in the kinetic energy of the system:
$$ \Delta T_B = \left( \frac{m_A v^2}{2} + \frac{m_B 0^2}{2} \right) - \left( \frac{m_A 0^2}{2} + \frac{m_B 0^2}{2} \right)  = \frac{m_A v^2}{2}.  $$
Could you please point out the flaw in this reasoning?
 A: The usual laws of kinematics are valid in inertial frames of reference only.  In particular, inertial frames of reference move with constant velocity.  So you can't apply the laws of physics as you've learned them if your reference frame is actually fixed to a body that undergoes acceleration.  You can have the reference frame start out with the same velocity as one of your bodies before the collision; you can have it end up with the same velocity as one of your bodies after the collision; but you can't have it both ways.
So a correct analysis of your problem could use a frame $F_A$ that starts out with the same velocity as body $A$, or a frame $F_B$ that starts out with the same velocity as body $B$...  or literally any inertial frame, though it's probably easiest in either of those two.  Using conservation of momentum, and arbitrarily picking the sign of $v$, we have
\begin{align}
  F_A: \qquad -m_B\, v &= (m_A+m_B)v_{f, A} &\qquad \Delta T_A &= \frac{m_B v^2}{2} - \frac{(m_A+m_B)v_{f,A}^2}{2} \\
  F_B: \qquad \hphantom{-}m_A\, v &= (m_A+m_B)v_{f, B} &\qquad \Delta T_B &= \frac{m_A v^2}{2} - \frac{(m_A+m_B)v_{f,B}^2}{2}.
\end{align}
Solve either of the equations on the left for either $v_f$, plug that into the corresponding equation on the right, and you get
\begin{equation}
 \Delta T_A = \Delta T_B = \frac{m_A m_B}{m_A+m_B} \frac{v^2}{2}.
\end{equation}
It's the same for either frame.
Another good frame is the center-of-mass frame, $F_{AB}$, in which the velocity of the final combined object is $0$.  Momentum conservation is expressed by
\begin{equation}
  m_A v_A + m_B v_B = 0,
\end{equation}
and by the definition of the relative velocity $v$ we have
\begin{equation}
  v_A - v_B = v.
\end{equation}
Various rearrangements of these equations let us write
\begin{align}
  v_A &= \frac{m_B}{m_A+m_B} v, \\
  v_B &= -\frac{m_A}{m_A+m_B} v.
\end{align}
So we get
\begin{equation}
  \Delta T_{AB}
  =
  \left( \frac{m_A v_A^2}{2} + \frac{m_B v_B^2}{2} \right) - \left( \frac{m_A 0^2}{2} + \frac{m_B 0^2}{2} \right)
  =
  \frac{m_A m_B}{m_A+m_B} \frac{v^2}{2}.
\end{equation}
Again, it's the same answer.
A: The problem is that you assume that the reference frames $S_A$ and $S_B$ stay the inertial frames before and after the collision even though their velocities change abruptly at the collison. It would be better to use the center of mass reference frame which does not change with the collision.  
