Consider a point-particle $p$ on an arbitrary curve defined by the function $f(x)$. It's constrained to always live within the curve. I.e; it always has coordinates $(x, f(x))$ and hence cannot "fly off". It experiences gravity and friction.
I'd be surprised if this hasn't been asked yet, but I'm baffled that not only can I not seem to derive a differential equation that describes the system, but I cannot find an answer that includes both friction and the constraint that it's bounded to the curve.
This question describes a similar scenario, however that system is frictionless and (as far as I can tell) doesn't constrain the particle to the curve.
My attempt
First things first, the kinematics is highly dependent on the instantaneous angle of the curve $\theta$, which can be defined through the identity $\tan\theta=\frac{dy}{dx}$, relating it to the slope. Before that's used, it's relatively trivial to find the net acceleration in each the $x$ and $y$ directions.
$$\Sigma_xF=|F_g|\sin\theta-|F_f|\cos\theta$$ $$\Sigma_xF=mg\sin\theta-\mu mg\cos\theta$$ $$\implies a_x=g(\sin\theta-\mu \cos\theta)$$
$$\Sigma_yF=|F_n|\cos\theta-|F_g|$$ $$\Sigma_yF=mg\cos^2\theta-mg$$ $$\implies a_y=-mg\sin^2\theta$$
(Where $F_g$ is the force of gravity, $g$ is the acceleration of gravity, $F_f$ is the force of friction, $\mu$ is the coefficient of friction, $m$ is the mass, and $F_n$ is the normal force.)
I assume the next steps are to substitute trigonometric identities such as
$$\cos(\theta)=\cos\Big(\tan^{-1}\Big(\frac{dy}{dx}\Big)\Big)=\frac{\frac{dy}{dx}}{\sqrt{\Big(\frac{dy}{dx}\Big)^2+1}}$$
and differentiation rules such as
$$\frac{dy}{dx}=\frac{\frac{dy}{dt}}{\frac{dx}{dt}}$$
to finally find a time-dependent equation for the motion of $p$ along the $x$-axis (because it's vertical coordinate is dependent on it's $x$-coordinate, by the curve-bounding constraint). However it's at this point my brain shuts off and I can't remember basic calculus and kinematics; especially with the added difficulty of not allowing the particle to fly off the curve. Beyond the scope of my question, is this still solvable if $f$ is also dependent on time?