I'm attempting to analytically stitch together two linear functions with two quadratic functions. The function I'm considering, then, is a piecewise function consisting of 4 parts. Below are the values I'm considering for the scenario as well as the function itself. 

k1 = 1.41; k2 = 1.45; eps1 = 2*^8; eps2 = 3.5*^8; p0 = 1.04*^8; delP = 0.01*^8;
kmax = (1/2)(k1 + k2) + (k2 p0 + eps2 - k1 p0 - eps1)/delP;
edens[p_] := Piecewise[{{k1 p + eps1, p &lt;= p0 - delP},
                    {(1/2)(kmax - k1)/delP * (p-p0)^2 + kmax(p-p0) + (k1 p0 + eps1) + (1/2)delP * (kmax - k1), p0-delP &lt;= p &lt;= p0},
                    {(1/2)(k2 - kmax)/delP * (p-p0)^2 + kmax(p-p0) + (k2 p0 + eps2) + (1/2)delP * (k2 - kmax), p0 &lt;= p &lt;= p0+delP},
                    {k2 p + eps2, p &gt;= p0 + delP}}];


This function is continuous and differentiable at the boundary points, which you can see by plotting it:

Plot[edens[p], {p, p0 - 2*delP, p0 + 2*delP}, Exclusions -&gt; None]




However, if I try and evaluate the derivative of this function at the boundary points (p0, p0-delP, and p0+delP), I get Indeterminate even though the value is the same on both sides.

I have a feeling this is because I'm using approximate real numbers. Is there anyway to force Mathematica to say that the derivative at a boundary point is a specific value?


Question: How do I restore my wolf's health in minecraft?
Answer: You have 2 options. They are:


Feed it some food. (Must be meat. Fish and plants will not work. Rotting flesh works.)
Throw a splash potion of healing.


Usually people go for number 1 because they have excess rotting flesh, which the wolf eats. Whether the food is raw or cooked does not matter. The wolf will not get hunger or poisoning no matter what.