I have the following code to plot two parabola-like "functions":
\begin{tikzpicture}[
remember picture,
overlay
]
\tikzmath{
\w = 4;
\yVs0 = 2;
\yVsl = 1;
\yVsf = 3;
\yss0 = \yVs0*2;
\yssl = \yVsl*1.5;
\yssf = \yVsf*1.1;
}
\tikzset{
shift={(current page.center)}
}
\begin{scope}[
shift={($0.5*(-\w,-\w)$)}
]
\draw[->,thick] (0,0) -- (\w,0);
\draw[
blue]
(0,\yVs0) .. controls (\w*1/4,\yVsl) and (\w*3/4,\yVsl) .. (\w,\yVsf);
\draw[
red]
(0,\yss0) .. controls (\w*1/4,\yssl) and (\w*3/4,\yssl) .. (\w,\yssf);
\end{scope}
\end{tikzpicture}
How can I plot the y-coordinate difference between these two curves? For example, by placing N markers along each functions at regular x-coordinate steps, and taking the y-coordinate difference of those.


(x_0,y_0)to(x_1,y_1)with control points(x_a,y_a)and (x_b,y_b)is known, see e.g. https://tex.stackexchange.com/a/501154/194703. This allows you to derive the difference analytically. Otherwise you could just usecalcandintersections`. – Dec 03 '19 at 20:08