Dale said:
Well, you have to be careful. Consider a spinning disk. In the frame where the disk has ##p=0## it also has ##KE \ne 0##. That non-zero KE in the center of momentum frame does contribute to the "rest mass", which I find confusing. So I prefer to say "invariant mass" for that reason.
True, let's go through the whole thing in detail for the OP's benefit, hopefully they're still around. This is in the context of special relativity.
step 1. Ensurer you have an isolated, self-contained system, so the rest mass is defined
step 2. Compute the total energy E of this system. Call it E.
step 3. Compute the total momentum of the system, call it p.
step 4. Compute ##\sqrt{(\frac{E}{c^2})^2-(\frac{p}{c})^2}##. This is the rest mass of the system.
This is most simply done in the frame of reference where the momentum is zero, in which case the rest mass is m=E/c^2. However, as long as the system is complete and not strongly interacting with its environment, the rest mass can be computed in any desired frame by the above procedure, if one knows how to compute E and p. Unfortunately, some of the details of precisely computing E and p for a anything more complex than a point particle is rather advanced. Correctly computing in detail the exact mass of a spinning disk including all relativistic effects would not be an undergraduate problem, though it is simple to note that adding energy to the disk by making it rotating does increases its mass. The disk can be thought of as composed of particles, but these particles are interacting, not isolated, so knowing the formula for an isolated particle isn't sufficient. Egan did some work on this problem in
https://www.gregegan.net/SCIENCE/Rings/Rings.html. The good news is that any physically reasonable disk would self-destruct long before any relativistic effects became significant.
Rather than going into the detailed calculations, some general observations are more likely to be helpful. If one has a "box" of gas, and one heats up said box, the mass after heating is ever so slightly larger than the mass before heating due to the energy added to the box. Note that we regard the box as isolated before the heating, not isolated during the heating, and isolated again after it's heated. If the box is allowed to cool down again, the energy is lost and the mass of the box decreases. Similarly if one has a spring + screw rod combination, where turning the screw stretches the spring, turning the screw does mechanical work on the system and it's mass increases. In your example of the spinning disk, spinning the disk requires energy, adding this energy makes the mass of the spinning disk very slightly larger. If one imagines a very strong box containing an atomic bomb that is totally sealed, exploding the bomb doesn't change the mass of the box as long as the box doesn't fail and nothing escapes the box. (This is rather unlikely for a real box). Energy is converted from one form to another but the mass of the system doesn't change. The mass changes only when energy enters or leaves the system.