Differentials in Statistical physics and Thermodynamics In physics courses, one is taught to think of $dU$ as "a small change in the Potential Energy". I wonder what a precise mathematical definition of these objects might be. For example, in the first law of thermodynamics 
$$
        dQ=dU+dW
$$
what is this $d$? Is it the exterior derivative? I don't know how to make sense of it.
Also, setting $dQ=TdS=dU+dW=dU+pdV-\mu dN$, how can one justify that $\frac{\partial S}{\partial U}|_{V,N}=\frac{1}{T}$ ?
 A: For a different example, we can look at
$$dE=TdS-pdV$$
This is a compact notation saying that $E$ depends on $S$ and $V$, $\frac{\partial E}{\partial S}=T,\frac{\partial E}{\partial V}=-p$. One does not need to really make sense of the differential symbols themselves, instead you can think of this as just a shorthand. Indeed I would suggest this approach, because without this you will tend to make mistakes such as expecting $\frac{\frac{\partial E}{\partial S}}{\frac{\partial E}{\partial V}}=\frac{\partial V}{\partial S}$ when in fact there is a minus sign involved.
The dQ example is similar except that Q is not a state function, so it does not make sense to say "Q depends on U and W". Still, given a path between two configurations you can determine the heat change by integrating dQ along that path.
Part of the reason that this seemingly peculiar notation is used in thermodynamics is that really every state function can be thought of as depending on some other set of state functions. For example, one can describe the equilibrium behavior of some gas through $E(S,V)$ or $S(E,V)$; both are equally valid, it just depends on your preferences. This differential notation puts the two presentations on more similar footing than the usual mathematical notation does.
A: We start by defining partial differentiation versus total differentiation for a scalar valued function $f:\mathbb{R}^n\rightarrow\mathbb{R}$ in a vector field $\mathcal{V}:\mathbb{R}^n\rightarrow\mathbb{R}^n$. For each $v\in\mathbb{R}^n$, we will write $\mathcal{V}(v)$ for the vector assigned to $v$ under $\mathcal{V}$ and  $$f(v)=f(v_0,\dots,v_{n-1}),$$ where the indexing is a relic of the fact that I am mostly a set theorist by training.

Let $\mathcal{F}(\mathbb{R}^n)$ be the set of all functions from $\mathbb{R}^n$ to $\mathbb{R}$. We define an operator $\partial_i:\mathcal{F}(\mathbb{R}^n)\rightarrow\mathcal{F}(\mathbb{R}^n)$ such that for each function $f:\mathbb{R}^n\rightarrow\mathbb{R}$, $\partial_i(f):\mathbb{R}^n\rightarrow\mathbb{R}$ is the unique function obtained by defining $$\partial_i(f(v))=\partial_if(v)=\lim_{h\rightarrow0}\frac{f(v_0,\dots,v_{i}+h,\dots,v_{n-1})-f(v_0,\dots,v_i,\dots,v_{n-1})}{h}$$ for all $v\in\mathbb{R}^n$. We will refer to $\partial_i$ as the $i^{th}$ partial derivative operator on $\mathbb{R}^n$. Viewing a function as a set of ordered pairs, we have $$\partial_i=\{\big(f,\partial_i(f)\big):f\in\mathcal{F}(\mathbb{R}^n)\}.$$

This is a pretty rough definition of partial differentiation, but it gets the point across and is fully correct for strictly Euclidean space. Computing the $i^{th}$ partial derivative of some scalar valued function amounts to taking a limit of the 'change quotient' of the function as we change the $i^{th}$ input coordinate by a smaller and smaller amount at each vector in the domain of our function.
For total differentiation, I beieve we can use the following:

Let $\mathcal{F}(\mathbb{R}^n)$ be as above. We define an operator $\mathcal{d}_i:\mathcal{F}(\mathbb{R}^n)\rightarrow\mathcal{F}(\mathbb{R}^n)$ such that for each function $f:\mathbb{R}^n\rightarrow\mathbb{R}$, $\mathcal{d}_i(f):\mathbb{R}^n\rightarrow\mathbb{R}$ is the unique function obtained by defining $$\mathcal{d}_i(f(v))=\mathcal{d}_if(v)=\partial_if(v)+\sum_{j\neq i}\partial_jf(v)\frac{dv_j}{dx_i}$$ for all $v\in\mathbb{R}^n$. We will refer to $\mathcal{d}_i$ as the $i^{th}$ total derivative operator on $\mathbb{R}^n$. Viewing a function as a set of ordered pairs, we have $$\mathcal{d}_i=\{\big(f,\mathcal{d}_i(f)\big):f\in\mathcal{F}(\mathbb{R}^n)\}.$$

I have cheated a little bit by using the Liebniz notation $\frac{dv_j}{dx_i}$ to 'bake in' all of the one-dimensional calculus implicitly taking place here, but essentially the idea is that if $v=\mathcal{V}(r)$ for $r=(x_0,\dots,x_{n-1})\in\mathbb{R}^n$ (if it is a vector under the image of the vector field) then each $v_i$ is a function in up to $n$ variables $x_0,\dots,x_{n-1}$. If the coordinates of $v$ depend on more than one coordinate of $r$, the total derivative takes this mutual dependence into account using the above process.
I will have to think some more on how exactly to get a nice view of these operations in a physical parameter space, but these should be the definitions you're looking for.
