How to fit a sinusoid to 2 points and their gradients Given the sinusoidal function
$$f(x) = a \cos(n x + b) + c,$$
if I know $f(x_1)$, $f(x_2)$, $f'(x_1)$ and $f'(x_2)$ is it possible to determine $a, b, c$ and $n$, with $x \in [0,\tfrac{2\pi}{n})$
Edit: put bounds on $x$ so that only one complete cycle is considered.
Edit 2: Current progress:
Let $p = p'/n$ and $x = x'-p'$ then
$$f(x) = a \cos(n x') + c$$
and
$$f'(x) = -an\sin(n x') + c$$
Let $x_2 = x_1 + w$, then we have
$$\frac{f'(x_2)}{f'(x_1)} = \frac{-na \sin(nx_1' + nw)}{-na \sin(nx_1')}$$
$$ = \cos(nw) + \frac{\sin(nw)}{\tan(nx_1')}$$
Rearranging,
$$x_1' = \frac{\tan^{-1} \left( \frac{\sin(nw)}{\frac{f'(x_2)}{f'(x_1)} - \cos(nw)} \right)}{n}$$
which gives $p$ from before $(p = (x_1'-x_1)/n)$.
I'm most interested in finding $n$ so even if $a$ and $c$ can't be found it woudn't matter. Perhaps the above can be rearranged to give $n$?
Edit 2: Answered own question below.
 A: Your question leads to the solvability of $\mathbf{F}(\mathbf{x},\mathbf{y})=0$ where
$$\mathbf{x}=(a,n,b,c),$$
$$\mathbf{y}=(f_{1},f_{2},f'_{1},f'_{2}),$$
and
$$\mathbf{F}(\mathbf{x},\mathbf{y})=\left[\begin{array}{l}a\cos(nx_{1}+b)+c-f_{1}\\a\cos(nx_{2}+b)+c-f_{2}\\-an\sin(nx_{1}+b)-f'_{1}\\-an\sin(nx_{2}+b)-f'_{2}\end{array}\right].
$$
So whenever $$\det J\mathbb{F}(a,n,b,c)=\left|\frac{\partial(F_{1},F_{2},F_{3},F_{4})}{\partial(a,n,b,c)}\right|\neq0,$$
it will follow from the implicit function theorem that the 4-tuple $(a,n,b,c)$ is solvable in terms of the given parameters $(f_{1},f_{2},f'_{1},f'_{2})$, and this will give you the desired sinusoid (note that $\mathbb{F}$ is continuously differentiable with respect to $\mathbb{x}$, so the Jacobian exists, only that its non-vanishing needs to be verified for some $\mathbb{y}$).
On the other hand, from a practical point of view, solving the non-linear system does not appear to be easy in general.  A numerical method like Newton iteration could be used though if you actually needed to calculate the parameters, but it doesn't sound like this is what you're after.
A: There are trivially many solutions if $n$ is not known.
e.g. consider $f'(x_1) = v$, $f'(x_2) = -v$, $f(x_1) = f(x_2) = 0$ where $x_1 = -x_2$.
Then we have
$$ a = \frac{f'(x_1)}{-n\sin(n x_1)}$$
$$ b = 0 $$
$$ c = -a \cos(n x_1) $$
$$ n < \frac{\pi}{2 |x_1|} $$
which will satisfies the constraints.
