# How to find the maximum of logistic function

Suppose I have a logistic function as follows: $f(x) = \frac{L}{1+e^{-k(x-x_0)}}$. I know that the maximum of the curve is $L$. Suppose I have a two-piece logistic function: $f(x) = \frac{L_1}{1+e^{-k_1(x-x_1)}} + \frac{L_2}{1+e^{-k_2(x-x_2)}}$, what is the local maximum? It's not simply $L_1 + L_2$, correct?

Suppose $L_1 = 1.2, k_1 = -0.8, x_1 = 6.3, L_2 = 3.3, k_2 = 1.1, x_2 = 2.7$, and the curve is as follows. I have a local maximum (found numerically) of $3.94$ at $x = 5.22$. I want to be able to find this local maximum via a closed form expression of the parameters in $f(x)$. It is noted that the supremum of the curve is $L_1 + L_2 = 4.5$, but that doesn't seem to correspond to the local max here?

I assume $k$ and $L$ are positive, but it doesn't change much if some signs are changed. The maximum is not $L$, that is the supremum, meaning it is never properly attained. $f$ approaches $L$ as $x$ tends to $\infty$.

Moreover, $f$ is strictly increasing: as $x$ increases, $\exp(-k(x-x_0))=\exp(kx_0)\cdot\exp(-kx)$ decreases, and hence the denominator decreases, so $f$ as a whole increases. This is another way to see that we can always go higher (by increasing $x$). Conversely, we can also always go lower (by decreasing $x$), so $f$ has neither local maxima nor minima.

The same reasoning shows that the two-piece logistic function also does not have local maxima or minima, and that its supremum (not maximum) is $L_1+L_2$.

EDIT: For a differentiable function $f$, any local extremum $x$ of $f$ satisfies $f'(x)=0$. Now, for the two-piece logistic function we have

$$f'(x)=\frac{L_1k_1e^{-k_1(x-x_1)}}{{\left(1+e^{-k_1(x-x_1)}\right)}^2}+\frac{L_2k_2e^{-k_2(x-x_2)}}{{\left(1+e^{-k_2(x-x_2)}\right)}^2}$$

So you need to find $x$ such that $f'(x)=0$. Of course, this is only possible if $L_1k_1$ and $L_2k_2$ have opposite signs. I'm not sure there's an analytical pretty answer to this (meaning an answer in terms of elementary functions).

• Thanks for the prompt reply. I edited my question with a concrete example (one with a local maximum). I found the local max numerically but is there a way to find it analytically? I know there is a difference between sup and max, and it seems like $L_1 + L_2$ doesn't correspond to the local max in my example? – Adrian Mar 28 '17 at 22:07
• See the edit. I don't think there's a pretty formula for what you're looking for. – Fimpellizieri Mar 28 '17 at 22:17