# Discontinuous functions in partition functions

I am trying to model a system where once the pressure is more than $10kpa$, a door breaks and the volume doubles.

Suppose the following example for a partition function:

$$Z=\sum_{i=1}^N{e^{-p V(p)}}$$

where

$$V(p)=\begin{cases} 2 & p>10\\ 1 & \text{otherwise} \end{cases}$$

We can calculate

\begin{align} \overline{V}&=-\frac{\partial \ln{Z}}{\partial \beta}=-\frac{1}{Z} \frac{\partial Z}{\partial \beta} \\ &=-\frac{1}{Z} \left[ \sum_{i=1}^N{e^{-p V(p)} \left( -V(p) - \beta V'(p) \right) } \right] \\ &=\frac{1}{Z} \sum_{i=1}^N{e^{-p V(p)} V(p) } + \frac{1}{Z} \sum_{i=1}^N{e^{-p V(p)} p V'(p) } \\ \end{align}

The last line is true if the second term is equal to zero and with the exception of $p=10$, it is.

\begin{align} &=\frac{1}{Z} Ne^{-p V(p)} V(p)\\ &=\begin{cases} \frac{1}{Z} Ne^{-p2} 2 & p>10\\ \frac{1}{Z} Ne^{-p} & \text{otherwise} \end{cases} \\ &=\begin{cases} 2 & p>10\\ 1 & \text{otherwise} \end{cases} \end{align}

## Questions:

Can this legitimately be a valid partition function?

Considering the following:

A. The partition function is obtained as a result of using the Lagrange multiplier method of optimization where the constraint functions must have continuous derivatives. And $V(p)$ is highly discontinuous.

B. The Lagrangian multiplier is used in the $V(p)$ function it is supposed to be conjugated to. Can these legitimately be used?