A y=f(x) function is given as path; for a set of x-coordinates, I want to place node (x,f(x)) onto the path, and connect it with (x,0) with vertical line.
I have not got very far myself:
\tikz{
\def\fSpec{ (-2,-2.2) .. controls (-1,2.5) and (.5,-1.7) .. (2,1.6) }
\def\xxx{{-1.9,-1.3,-.8,-.2,.4,.9,1.5,2.0}}
\draw[thin] \fSpec;
\foreach\x in \xxx{
%% how to find f(\x) here?
}
}
I've know about the intersections library, but it seems like overkill; I would like to learn something more elegant.
I cannot give parametrically along the path length, because there will be multiple functions with different shapes and the points need to have the same x-coordinates for all of them.
y = f(x)
then the intersections library is most definitely not overkill. Otherwise you are trying to solve p(t) = x and then substitute back in for y = q(t). The first of these involves solving a cubic which, although possible, is not pretty. The routine used by the intersection library for finding intersections is, I think, really quite an elegant solution to this problem.