$f'(x)=f(\cos(x))$ Some time ago, I solved (just for fun) $f'(x)=\cos(f(x))$ and asked myself what the solution to the title equation $f'(x)=f(\cos(x))$ is. I see that $f$ is periodic and odd, but not how to go on after that.  
(Related question: Is there a general solution for $f'(x)=f(g(x))$ with given $g$?)
 A: Let $x_0\in(0,\pi)$ be the solution to $x_0 = \cos(x_0)\approx 0.739$. If we let
$$
f(x) = \sum_{n=0}^\infty a_n(x-x_0)^n
$$
and expand the differential equation in power series, we get
$$
\sum_{n=0}^\infty (n+1)a_{n+1}(x-x_0)^n = \sum_{n=0}^\infty a_n(\cos(x)-x_0)^n = \sum_{n=0}^\infty a_n(x-x_0)^n\left[\frac{\cos(x)-\cos(x_0)}{x-x_0}\right]^n.
$$
Now $([\cos(x)-\cos(x_0)]/[x-x_0])^n$ can itself be written as some power series $\sum_{m=0}^\infty b_{mn}(x-x_0)^m$. So we have
$$
\sum_{n=0}^\infty (n+1)a_{n+1}(x-x_0)^n =\sum_{n=0}^\infty a_n(x-x_0)^n\left[\frac{\cos(x)-\cos(x_0)}{x-x_0}\right]^n \\= \sum_{n=0}^{\infty}\sum_{m=0}^\infty a_nb_{mn}(x-x_0)^{n+m}= \sum_{k=0}^\infty \left[\sum_{n=0}^ka_nb_{(k-n)n}\right](x-x_0)^k.
$$
Swapping the dummy indices $k$ and $n$ then gives a recursion relation for the coefficients:
$$
a_{n+1} = \frac{1}{n+1}\sum_{k=0}^n a_kb_{(n-k)k}.
$$
Unfortunately I'm not aware of a nice expression for the $b_{mn}$. Calculating the first 30 terms numerically and taking advantage of symmetry gives me this for $f(x)$

and a comparison of $f'(x)$ (blue) with $f(\cos(x))$ (yellow)

The series matches up well out until about $x_0 + 1.4$, and applying the root test to the coefficients suggests it has a finite radius of convergence of about $1.8$, so I think this is getting the right solution. This is consistent with a function that has a singularity at $i\pi/2$, so it's possible there's a global solution on $\mathbb R$ that this method can't quite catch. All other solutions are constant multiples of this one (which is $f(x_0) = 1$).
EDIT: Actually, since this method does give $f(x)$ for $x\in [-1,1]$, we have $f(\cos(x))$ for all $x\in \mathbb R$. We should be able to get the function on the rest of $\mathbb R$ by just integrating $f(\cos(x))$. This gives a function of the form $f(x) = f(0) + f(0)x + g(x)$, where $g(x)$ is some oscillatory function with period $2\pi$ and average value $0$ that looks sort of like $\sin(x)$. Not sure how much better we can do analytically.
A: I am getting an absurd answer, obviously doing something wrong, but can't see where. So, here is my (wrong) solution for the record and to find the error.
Let $x\in(0,\pi)$ and $z = \cos x$, $dz/dx = -\sin x$ and $x = \arccos z$.
$$
\frac{df}{dx} = \frac{df}{dz}\frac{dz}{dx} = -\sin x\frac{df}{dz}
$$
Or
$$
-\sin x \frac{df}{dz} = -\sin(\arccos z)\frac{df}{dz}=-\sqrt{1-z^2}\frac{df}{dz}
$$
From here:
$$
\frac{df}{dz} = -\frac{1}{\sqrt{1-z^2}}f(z)
$$
$$
\frac{df}{f} = -\frac{dz}{\sqrt{1-z^2}}\quad\Rightarrow\quad \ln f=\arccos z
$$
$$
f = \exp\left(\arccos z\right)=\exp x
$$
So, $z$ and $x$ have one-to-one correspondence for $x\in(0,\pi)$. $z^2<1$, so I've not divided by zero. $f$ can be zero --- by dividing by it I probably lost some solution, but it shouldn't have led to such absurdity...
A: Too long for a comment.
Observe that $f'(x+2\pi n)=f'(x)$ for all $n\in\mathbb Z$, so $f(x+2\pi n)=f(x)+n\varepsilon$ for some constant $\varepsilon$ (which we assume nonzero).  If you let $f(x)=(\varepsilon/2\pi)(1+x+g(x))$, then this implies $g(x+2\pi n)=g(x)$, i.e. $2\pi$ periodicity.  If we assume that $g$ is bounded, then we obtain the result
$$
f(x)\sim \varepsilon x/2\pi,\qquad |x|\to\infty,
$$
provided $\varepsilon\neq 0$.  Here, the lower order term $g$ solves the equation
$$
g'(x)=\cos(x)+g(\cos(x)).
$$
The other case $\varepsilon=0$ is the $2\pi$-periodicity of $f(x)$.
