TITLE: Potential energy in the first law of thermodynamics
QUESTION [1 upvotes]: Let's say I supply heat Q to a system. If it's internal energy increases by U and the work done on it is W then by the first law of thermodynamics, Q = U + W. Now, let's say that due to the thermal expansion, the gravitational potential energy of the system also increases by P. Would it be right to say Q = U + W + P? What if the kinetic energy also increases(by K), is it right to say Q = U + W + P + K

REPLY [3 votes]: Yes.
The 1st law of thermodynamics comes from basic energy conservation covering all involved energies:**
$$E_1+W+Q=E_2\qquad\text{or rewritten:}\qquad \Delta E=W+Q $$
where $E$ represents all present energy (the sum of kinetic, potential, chemical, thermal...) and $W$ and $Q$ represent all energy added (work or heat). We could, if we wanted to, expand the formula into its parts:
$$\Delta K+\Delta U_\text{gravity}+\underbrace{\Delta U_\text{elastic}+\Delta U_\text{chemical}+\Delta E_\text{thermal}}_{\text{internal energies }\Delta U_i}+\cdots=W+Q $$
Some of these may be considered internal, such as thermal and chemical energies, and possibly elastic energy, and more and they are often grouped together and symbolised $U_i$ or similar.***
In typical thermodynamic applications (when dealing with refrigeration system, pumps, heating systems etc.), gravitational potential energies, kinetic energy and other macro-scale energies are not relevant or negligible. Therefore, typically, only internal energies are left. And that's why you most often see the 1st law of thermodynamics written like this:
$$\Delta U_i=W+Q$$

** Note that the sign convention for $W$ and $Q$ can be a bit unclear, and my use here may not match what you are used to seeing due to a different definition.
*** Depending on your system, it will vary a lot which energies that are within the system, in which case they are also covered for in the group called "internal energy". So don't take my indication here too generally.


TITLE: If $f \colon[ a, b] \rightarrow \mathbb{R}$ is bounded and Riemann-integrable, is $F(x):=\int_a^xf(t)dt$ always differentiable?
QUESTION [1 upvotes]: Is the following statement true or false?

Let $ f \colon [ a, b] \rightarrow \mathbb{R}$ be a bounded and Riemann-integrable function. Define
  $$ [a,b]\ni x\mapsto F(x) = \int_{a}^{x} f(t) dt.$$
  Then the  function $ F$ is differentiable on $(a,b)$.

My attempt: I thinks this statement is false. As a counterexample I am thinking of
$$ f(x) = \begin{cases} |x|, & x \in [-1,1], \\ 1,&  \text{otherwise.} \end{cases}$$
Is this correct?

REPLY [2 votes]: Your example doesn't work because $f$ is continuous. Take $f(x)=-1$ for $-1 \leq x \leq 0$ and $f(x)=1$ for $0 < x \leq 1$. If you compute $F$ you will see that the right hand derivative of $F$ at $0$ is $+1$ and the left hand derivative is $-1$.

REPLY [1 votes]: Your counterexample won't work because the derivative of $F$ is just $f$ on $(a,b)$.
Take $f\colon[0,2]\to \Bbb R$ as the step function with $f(x)=0$ for $x<1$ and $f(x)=1$ for $1\le x\le 2$. Then $f$ is Riemann integrable, and $F$ is a piecewise linear function which is $0$ from $0$ to $1$, and then $F(x)=x-1$ for $1\le x\le 2$. In particular $F$ is not differentiable at $1$.