I am working with spline functions using the B-spline basis, $$ f(x) = \sum_{i=1}^n c_i B_i(x;\mathbf{t}) $$ where the $B_i$ are cubic B-splines with a knot vector $\mathbf{t}$. For my application, the vector $x$ has units of length, and I am trying to find the best way to nondimensionalize the problem to improve numerical stability. The wiki page on Nondimensionalization suggests simply to scale the values by some appropriate constant, $$ \chi = \frac{x}{x_s} $$ where $\chi$ has no units, and $x_s$ is an appropriate scale length for the problem (about $10^6$ for my problem). With this approach, my spline would become, $$ f(x) = \sum_{i=1}^n c_i B_i(\chi; \mathbf{t}_{\chi}) $$ Using B-splines defined on the $\chi$ variable definitely improves numerical stability when integrating and differentiating the spline. However I am still running into problems. In particular, when computing the 3rd derivative of the spline, I get values on the order of $10^9$ which are causing numerical accuracy problems in later computations.

The matlab algorithm for polynomial fitting, called polyfit, does the following scaling transformation prior to fitting the polynomial, $$ \chi = \frac{x - \mu}{\sigma} $$ where $\mu,\sigma$ are the mean and standard deviation of the $x$ vector. The page says that this improves the numerical properties of the fit. I tried using this approach with my spline, and indeed I find that all the derivative terms are close to 1, which seems to be a big improvement.

The purpose of my question is to ask whether the matlab approach is the best one for use with B-splines? The matlab page does not provide a reference to justify its scaling choice, and I have been unsuccessful in finding papers on this topic, especially related to B-splines. Does anyone know of the best way to scale the B-spline knots to get the best numerical accuracy when doing integration/differentation? Does anyone know of a good reference which discusses this problem?

  • $\begingroup$ To start the discussion: imo the dimensionless parameter appöied to all coordinates at once should not influence the total condition too much. What you gain in the spatial coordiantes you'll usually loose in the derivative terms. Thus, when you multiply the x-vector by $10^{-6}$, you'll multiply the derivative by $10^6$, which could explain the large values you obtain. $\endgroup$
    – davidhigh
    Dec 10, 2022 at 11:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.