Maxima を用いたスプライン補間の計算式の導出方法

--------------------------------------
区間数2
--------------------------------------

p0(x)=a0*x^3+b0*x^2+c0*x+d0
p1(x)=a1*x^3+b1*x^2+c1*x+d1
に関する条件式:

(0) 関数値
d0=y0
a0+b0+c0+d0=y1
a1+b1+c1+d1=y1
8*a1+4*b1+2*c1+d1=y2

(1) 1階微分
3*a0+2*b0+c0=3*a1+2*b1+c1

(2) 2階微分
6*a0+2*b0=6*a1+2*b1

(3) 自然境界
b0=0
12*a1+2*b1=0

--
Maxima への入力:
reset(y0);
reset(y1);
reset(y2);
a:matrix([0,0,0,1,0,0,0,0],[1,1,1,1,0,0,0,0],[0,0,0,0,1,1,1,1],[0,0,0,0,8,4,2,1],[3,2,1,0,-3,-2,-1,0],[3,1,0,0,-3,-1,0,0],[0,1,0,0,0,0,0,0],[0,0,0,0,6,1,0,0]);
v:transpose(matrix([y0,y1,y1,y2,0,0,0,0]));
b:invert(a);
b.v;

--
Maxima の出力 ( 出力を Copy as Text ):
matrix([y2/4-y1/2+y0/4],[0],[-y2/4+(3*y1)/2-(5*y0)/4],[y0],[-y2/4+y1/2-y0/4],[(3*y2)/2-3*y1+(3*y0)/2],[-(7*y2)/4+(9*y1)/2-(11*y0)/4],[y2/2-y1+(3*y0)/2])

--
Excel の計算式:
y2, y1, y0 を観測値の絶対参照に置換して
=$b$22/4-$b$12/2+$b$2/4
=0
=-$b$22/4+(3*$b$12)/2-(5*$b$2)/4
=$b$2

=-$b$22/4+$b$12/2-$b$2/4
=(3*$b$22)/2-3*$b$12+(3*$b$2)/2
=-(7*$b$22)/4+(9*$b$12)/2-(11*$b$2)/4
=$b$22/2-$b$12+(3*$b$2)/2

--------------------------------------
区間数3
--------------------------------------

p0(x)=a0*x^3+b0*x^2+c0*x+d0
p1(x)=a1*x^3+b1*x^2+c1*x+d1
p2(x)=a2*x^3+b2*x^2+c2*x+d2
に関する条件式:

(0) 関数値
d0=y0
a0+b0+c0+d0=y1
a1+b1+c1+d1=y1
8*a1+4*b1+2*c1+d1=y2
8*a2+4*b2+2*c2+d2=y2
27*a2+9*b2+3*c2+d2=y3

(1) 1階微分
3*a0+2*b0+c0=3*a1+2*b1+c1
12*a1+4*b1+c1=12*a2+4*b2+c2

(2) 2階微分
6*a0+2*b0=6*a1+2*b1
12*a1+2*b1=12*a2+2*b2

(3) 自然境界
b0=0
18*a2+2*b2=0

--
Maxima への入力:
reset(y0);
reset(y1);
reset(y2);
reset(y3);
a:matrix([0,0,0,1,0,0,0,0,0,0,0,0],[1,1,1,1,0,0,0,0,0,0,0,0],[0,0,0,0,1,1,1,1,0,0,0,0],[0,0,0,0,8,4,2,1,0,0,0,0],[0,0,0,0,0,0,0,0,8,4,2,1],[0,0,0,0,0,0,0,0,27,9,3,1],[3,2,1,0,-3,-2,-1,0,0,0,0,0],[0,0,0,0,12,4,1,0,-12,-4,-1,0],[3,1,0,0,-3,-1,0,0,0,0,0,0],[0,0,0,0,6,1,0,0,-6,-1,0,0],[0,1,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,9,1,0,0]);
v:transpose(matrix([y0,y1,y1,y2,y2,y3,0,0,0,0,0,0]));
b:invert(a);
b.v;

--
Maxima の出力 ( 出力を Copy as Text ):
matrix([-y3/15+(2*y2)/5-(3*y1)/5+(4*y0)/15],[0],[y3/15-(2*y2)/5+(8*y1)/5-(19*y0)/15],[y0],[y3/3-y2+y1-y0/3],[-(6*y3)/5+(21*y2)/5-(24*y1)/5+(9*y0)/5],[(19*y3)/15-(23*y2)/5+(32*y1)/5-(46*y0)/15],[-(2*y3)/5+(7*y2)/5-(8*y1)/5+(8*y0)/5],[-(4*y3)/15+(3*y2)/5-(2*y1)/5+y0/15],[(12*y3)/5-(27*y2)/5+(18*y1)/5-(3*y0)/5],[-(89*y3)/15+(73*y2)/5-(52*y1)/5+(26*y0)/15],[(22*y3)/5-(57*y2)/5+(48*y1)/5-(8*y0)/5])

--
Excel の計算式:
y3, y2, y1, y0 を観測値の絶対参照に置換して
=-$b$32/15+(2*$b$22)/5-(3*$b$12)/5+(4*$b$2)/15
=0
=$b$32/15-(2*$b$22)/5+(8*$b$12)/5-(19*$b$2)/15
=$b$2

=$b$32/3-$b$22+$b$12-$b$2/3
=-(6*$b$32)/5+(21*$b$22)/5-(24*$b$12)/5+(9*$b$2)/5
=(19*$b$32)/15-(23*$b$22)/5+(32*$b$12)/5-(46*$b$2)/15
=-(2*$b$32)/5+(7*$b$22)/5-(8*$b$12)/5+(8*$b$2)/5

=-(4*$b$32)/15+(3*$b$22)/5-(2*$b$12)/5+$b$2/15
=(12*$b$32)/5-(27*$b$22)/5+(18*$b$12)/5-(3*$b$2)/5
=-(89*$b$32)/15+(73*$b$22)/5-(52*$b$12)/5+(26*$b$2)/15
=(22*$b$32)/5-(57*$b$22)/5+(48*$b$12)/5-(8*$b$2)/5

--------------------------------------
参考までに
--------------------------------------
eq:[d0=y0,a0+b0+c0+d0=y1,a1+b1+c1+d1=y1,8*a1+4*b1+2*c1+d1=y2,3*a0+2*b0+c0=3*a1+2*b1+c1,6*a0+2*b0=6*a1+2*b1,b0=0,12*a1+2*b1=0];
var:[a0,b0,c0,d0,a1,b1,c1,d1];
solve[eq,var];
では失敗
--------------------------------------