Find all functions such that $f(c+x)+f(c-x)=k$ for some constants $c,k$

The question is inspired by this answer.

Find all continuous and differentiable functions $\mathbb{R} \to \mathbb{R}$ such that $f(c+x)+f(c-x)=k$ for some constants $c,k$ in some interval $x \in (a,b)$.

For the case $c=0$ we have the following solution:

$$f(x)=\frac{k}{1+e^{g(x)}}$$

Where $g(x)$ is an odd function $g(-x)=-g(x)$. And $x \in (-\infty,\infty)$.

What is the general solution for this problem? Or at least any other solution?

Edit

@Kelenner's comment provided the general solution, but it [the solution] looks very boring. To make it look a little more interesting, there is a generalization of the above for $c=0$:

$$f(x)=\frac{k}{1+p(x)}$$

Where $p(x)$ is such that $p(x)p(-x)=1$. For example, it could be:

$$p(x)=\left( \frac{1-q(x)}{1+q(x)} \right)^n e^{g(x)}$$

With $q(x),g(x)$ - some odd functions, $n$ - some real number.

$$f(x)=k\frac{(1+q(x))^n}{(1+q(x))^n+(1-q(x))^ne^{g(x)}}$$

• For the problem with $c=0$, if you put $h(x)=f(x)-k/2$, you find that $f$ is a solution if and only if $h$ is an odd function. Hence the general solution is $f(x)=k/2+h(x)$, where $h$ is an odd function. For the general problem with $c$, put $m(x)=f(x+c)$ to see that $m$ is a solution of the problem with $c=0$. So the general solution is $f(x)=k/2+h(x-c)$, whre $h$ is an odd function. – Kelenner Jul 24 '16 at 12:47
• @Kelenner, how does this fit with the solution I provided for $c=0$? – Yuriy S Jul 24 '16 at 12:51
• If you compute $h(x)=f(x)-k/2$, you find $h(x)=k\frac{1-\exp(g(x))}{2(1+\exp(g(x))}$, and as $g$ is odd, it is easy to see that $h$ is odd. But these are only particular solutions. – Kelenner Jul 24 '16 at 12:55
• @Kelenner, thanks! This could be an answer btw – Yuriy S Jul 24 '16 at 12:57
• You 're welcome – Kelenner Jul 24 '16 at 12:57