Spline Approximation (Mathematics II)

This is the third of a series of article about spline approximation. If you have not done so, you should start reading

So a function which is supposed to approximate a given set of points \{(\xi_j, \ety_j)\}_{j=1\ldots N} as a linear combination

    \[(1)\thickspace g(x) = \sum_{i} a_i f_i(x)\]

of functions f_i, as described in the previous article with

    \[(2)\thickspace f(x)= \begin{cases} 0 &\text{for } x \le -2\\ (x+2)^3&\text{for } -2 < x \le -1\\ 1+3(x+1)+3(x+1)^2-3(x+1)^3&\text{for } -1 < x \le 0\\ 1+3(1-x)+3(1-x)^2-3(1-x)^3&\text{for } 0 < x \le 1\\ (2-x)^3&\text{for } 1 < x \le 2\\ 0&\text{for } x > 2 \end{cases}\]

and with h chosen such that x_i=x_0+i*h for all i

    \[(3)\thickspace f_i(x)=f(\frac{x-x_i}{h}) \text{ for } i=-1,\ldots,n+1\]

Now up to four f_is can overlap in one sub-interval. Assuming the subinterval is

    \[S=[x_i,x_{i+1}]\]

and the arithmetic mean of the borders is

    \[X = \frac{1}{2}(x_i+x_{i+1}) = x_i + \frac{h}{2} = x_{i+1} - \frac{h}{2}\]

This interval is touched by the base functions f_{i-1}, f_i, f_{i+1}, f_{i+2}, so the function g can be written for x\in S as

    \[g(x)=af_{i-1}(x)+bf_i(x)+cf_{i+1}(x)+df_{i+2}(x)\]

    \[= af\left(\frac{x-x_{i-1}}{h}\right)    +bf\left(\frac{x-x_{i}}{h}\right)    +cf\left(\frac{x-x_{i+1}}{h}\right)    +df\left(\frac{x-x_{i+2}}{h}\right)\]

    \[= a\left(2-\frac{x-x_{i-1}}{h}\right)^3\]

    \[+b\left(1+3\left(1-\frac{x-x_{i}}{h}\right)+3\left(1-\frac{x-x_{i}}{h}\right)^2-3\left(1-\frac{x-x_{i}}{h}\right)^3\right)\]

    \[+c\left(1+3\left(\frac{x-x_{i+1}}{h}+1\right)+3\left(\frac{x-x_{i+1}}{h}+1\right)^2-3\left(\frac{x-x_{i+1}}{h}+1\right)^3\right)\]

    \[+d\left(\frac{x-x_{i+2}}{h}+2\right)^3 \text{ using (5)}\]

Now we have

    \[x_{i-1}=X-\frac{h}{2}\]

    \[x_{i}=X+\frac{h}{2}\]

    \[x_{i+1}=X+\frac{3h}{2}\]

    \[x_{i+1}=X+\frac{5h}{2}\]

and thus

    \[g(x) =a\,\left(2-{{x+{{h}\over{2}}-X}\over{h}}\right)^3\]

    \[+b\,\left(-3\, \left(1-{{x-{{h}\over{2}}-X}\over{h}}\right)^3+3\,\left(1-{{x-{{h  }\over{2}}-X}\over{h}}\right)^2+3\,\left(1-{{x-{{h}\over{2}}-X  }\over{h}}\right)+1\right)\]

    \[+c\,\left(-3\,\left({{x-{{3}\over{2}} h-X }\over{h}}+1\right)^3  +3\,\left({{x-{{3}\over{2}} h-X}\over{h}}+1 \right)^2  +3\,\left({{x-{{3}\over{2}} h-X}\over{h}}+1\right)+1 \right)\]

    \[+d\,\left({{x-{{{5}\over{2}} h-X}\over{h}}+2\right)^3\]

Now let

    \[y=x-X\]

and hence

    \[x=y+X\]

and substitute that:

    \[g(x)=a\,\left(2-{{y+{{h}\over{2}}}\over{h}}\right)^3\]

    \[+b\,\left(-3\,  \left(1-{{y-{{h}\over{2}}}\over{h}}\right)^3+3\,\left(1-{{y-{{h  }\over{2}}}\over{h}}\right)^2+3\,\left(1-{{y-{{h}\over{2}}}\over{h}}  \right)+1\right)\]

    \[+c\,\left(-3\,\left({{y-{{3\,h}\over{2}}}\over{h}}+1  \right)^3+3\,\left({{y-{{3\,h}\over{2}}}\over{h}}+1\right)^2+3\,  \left({{y-{{3\,h}\over{2}}}\over{h}}+1\right)+1\right)\]

    \[+d\,\left({{y-  {{5\,h}\over{2}}}\over{h}}+2\right)^3\]

    \[={{d\,y^3}\over{h^3}} -{{3\,c\,y^3}\over{h^3}} +{{3\,b\,y^3}\over{h^ 3}} -{{a\,y^3}\over{h^3}}\]

    \[-{{3\,d\,y^2}\over{2\,h^2}} +{{15\,c\,y^2 }\over{2\,h^2}} -{{21\,b\,y^2}\over{2\,h^2}} +{{9\,a\,y^2}\over{2\,h^2 }}\]

    \[+{{3\,d\,y}\over{4\,h}} -{{9\,c\,y}\over{4\,h}} +{{33\,b\,y}\over{4 \,h}} -{{27\,a\,y}\over{4\,h}}\]

    \[-{{d}\over{8}} +{{5\,c}\over{8}} +{{17\,b }\over{8}} +{{27\,a}\over{8}}\]

    \[=\frac{d-3\,c+3\,b-a}{h^3}\,y^3 +\frac{-3\,d+15\,c-21\,b+9\,a}{2\,h^2}\,y^2\]

    \[+\frac{3\,d-9\,c+33\,b-27\,a}{4\,h}\,y +\frac{-d +5\,c + 17\,b + 27\,a}{8}\]

This will be used to actually calculate g in programs.

Disclaimer: I am not an expert in numerical analysis. While I believe that the approach that this article comes up with is sound and useful, I do believe that an expert of numerical analysis could still improve the accuracy of the calculations.

How to actually program it will be covered in the upcoming article „Spline Approximation (Cookbook)“. The link will be added, when it is available.

Share Button

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

*