1
$\begingroup$

How do we determine maximum RMS error between a Cosine curve and a 3-spline Bezier curve given in answers from me and Mark H. (Again not cutting pasting to present the closed form and Bezier parametric equation here as the thread is accessible and running).

Is there a modification to the good old Gaussian procedure of least squares based on polynomials or quicker modern CAS supported developments that handle Parametrics&Polynomial?

I know it is easy to ask, but I ask expecting trouble as I had been there once into them both.

TwoCurves

$\endgroup$
1
$\begingroup$

The trick is to express both the function of $x$ and the parametric equation in $t$ in terms of the same variable. The RMS difference between the functions is $$\Delta_{rms} = \sqrt{\int_{x_0}^{x_1} [f(x) - g(t)]^2\,dx}$$ where $f(x)$ is expressed in terms of the $x$-coordinate and $g(t)$ is a parametric function of $t$ with a corresponding $x(t)$. Now we just make a variable substitution: $$x = x(t)$$ and $$dx = x'(t)\,dt$$ to get $$\Delta_{rms} = \sqrt{\int_{t_0}^{t_1} [f(x(t)) - g(t)]^2 x'(t)\,dt}.$$

$\endgroup$
1
$\begingroup$

This is fairly standard approximation theory, I think. Suppose we fix some polynomial degree, $n$. The set of polynomials of degree $n$ having zero first derivatives at start and end is a vector subspace, $S$. We are asking for the polynomial $p \in S$ that is "nearest" to our given function, $g$. Nearness can be measured using any reasonable norm. You suggested the $L_2$ norm, but others would work just as well. In many applications, the $L_\infty$ norm would be the most appropriate.

Suppose our norm comes from an inner product $\langle.,.\rangle$. Then a polynomial $p \in S$ is nearest to $g$ if $\langle p-g,q\rangle = 0$ for all $q \in S$. Since $S$ is finite dimensional, this is equivalent to saying that $\langle p-g,q\rangle = 0$ for all $q$ in some finite basis of $S$. This leads to a system of linear equations that you can solve to get the coefficients of $p$. Standard least-squares calculations in the case of the $L_2$ norm.

The $L_\infty$ norm does not come from an inner product, so it's much more difficult to handle. But, that's not what you asked about.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.