Example 3 

Orthogonal interpolatory masks satisfy sum rules of order 2 

 

> restart; 1
 

> read
 

> `assign`(d, 3); 1; `assign`(r, 2); 1; `assign`(h, 0); 1
 

 

 

`assign`(d, 3)
`assign`(r, 2)
`assign`(h, 0) (7.5.1)
 

> `assign`(multi, `*`(r, `*`(`+`(h, 1)))); 1
 

`assign`(multi, 2) (7.5.2)
 

> `assign`(poly, D1GenPolyMask(a, multi, -2, 3)); 1
 

`assign`(poly, Matrix(%id = 152365872))
`assign`(poly, Matrix(%id = 152365872))
`assign`(poly, Matrix(%id = 152365872))
`assign`(poly, Matrix(%id = 152365872))
(7.5.3)
 

> `assign`(eq1, D1GHInterpolatoryMaskEqs(poly, d, h)); 1
 

`assign`(eq1, {a101c3, `a102c-2`, a102c1, a201c0, a201c3, `a202c-2`, `+`(a101c0, `-`(`/`(1, 3))), `+`(a202c1, `-`(`/`(1, 3)))}) (7.5.4)
 

> `assign`(sln1, solve(eq1)); 1
 

`assign`(sln1, {a101c0 = `/`(1, 3), a101c3 = 0, `a102c-2` = 0, a102c1 = 0, a201c0 = 0, a201c3 = 0, `a202c-2` = 0, a202c1 = `/`(1, 3)})
`assign`(sln1, {a101c0 = `/`(1, 3), a101c3 = 0, `a102c-2` = 0, a102c1 = 0, a201c0 = 0, a201c3 = 0, `a202c-2` = 0, a202c1 = `/`(1, 3)})
(7.5.5)
 

> `assign`(poly1, subs(sln1, poly)); 1
 

`assign`(poly1, Matrix(%id = 177508696))
`assign`(poly1, Matrix(%id = 177508696))
`assign`(poly1, Matrix(%id = 177508696))
`assign`(poly1, Matrix(%id = 177508696))
(7.5.6)
 

> `assign`(eq2, D1GHIMaskSumRuleEqs(poly1, d, h, 2)); 1
 

`assign`(eq2, {`+`(`*`(`/`(5, 2), `*`(`a201c-1`)), `-`(`*`(`/`(1, 2), `*`(a201c2))), `a101c-1`, `-`(`*`(2, `*`(a101c2)))), `+`(`*`(`/`(7, 2), `*`(`a201c-2`)), `*`(`/`(1, 2), `*`(a201c1)), `*`(2, `*`(`...
`assign`(eq2, {`+`(`*`(`/`(5, 2), `*`(`a201c-1`)), `-`(`*`(`/`(1, 2), `*`(a201c2))), `a101c-1`, `-`(`*`(2, `*`(a101c2)))), `+`(`*`(`/`(7, 2), `*`(`a201c-2`)), `*`(`/`(1, 2), `*`(a201c1)), `*`(2, `*`(`...
`assign`(eq2, {`+`(`*`(`/`(5, 2), `*`(`a201c-1`)), `-`(`*`(`/`(1, 2), `*`(a201c2))), `a101c-1`, `-`(`*`(2, `*`(a101c2)))), `+`(`*`(`/`(7, 2), `*`(`a201c-2`)), `*`(`/`(1, 2), `*`(a201c1)), `*`(2, `*`(`...
`assign`(eq2, {`+`(`*`(`/`(5, 2), `*`(`a201c-1`)), `-`(`*`(`/`(1, 2), `*`(a201c2))), `a101c-1`, `-`(`*`(2, `*`(a101c2)))), `+`(`*`(`/`(7, 2), `*`(`a201c-2`)), `*`(`/`(1, 2), `*`(a201c1)), `*`(2, `*`(`...
`assign`(eq2, {`+`(`*`(`/`(5, 2), `*`(`a201c-1`)), `-`(`*`(`/`(1, 2), `*`(a201c2))), `a101c-1`, `-`(`*`(2, `*`(a101c2)))), `+`(`*`(`/`(7, 2), `*`(`a201c-2`)), `*`(`/`(1, 2), `*`(a201c1)), `*`(2, `*`(`...
(7.5.7)
 

> `assign`(sln2, solve(eq2)); 1
 

`assign`(sln2, {`a101c-1` = `+`(`/`(1, 9), a101c2, `-`(`*`(2, `*`(`a201c-1`)))), `a101c-2` = `+`(`-`(`/`(1, 9)), a101c1, `-`(`*`(2, `*`(`a201c-2`)))), a101c1 = a101c1, a101c2 = a101c2, `a102c-1` = `+`...
`assign`(sln2, {`a101c-1` = `+`(`/`(1, 9), a101c2, `-`(`*`(2, `*`(`a201c-1`)))), `a101c-2` = `+`(`-`(`/`(1, 9)), a101c1, `-`(`*`(2, `*`(`a201c-2`)))), a101c1 = a101c1, a101c2 = a101c2, `a102c-1` = `+`...
`assign`(sln2, {`a101c-1` = `+`(`/`(1, 9), a101c2, `-`(`*`(2, `*`(`a201c-1`)))), `a101c-2` = `+`(`-`(`/`(1, 9)), a101c1, `-`(`*`(2, `*`(`a201c-2`)))), a101c1 = a101c1, a101c2 = a101c2, `a102c-1` = `+`...
`assign`(sln2, {`a101c-1` = `+`(`/`(1, 9), a101c2, `-`(`*`(2, `*`(`a201c-1`)))), `a101c-2` = `+`(`-`(`/`(1, 9)), a101c1, `-`(`*`(2, `*`(`a201c-2`)))), a101c1 = a101c1, a101c2 = a101c2, `a102c-1` = `+`...
`assign`(sln2, {`a101c-1` = `+`(`/`(1, 9), a101c2, `-`(`*`(2, `*`(`a201c-1`)))), `a101c-2` = `+`(`-`(`/`(1, 9)), a101c1, `-`(`*`(2, `*`(`a201c-2`)))), a101c1 = a101c1, a101c2 = a101c2, `a102c-1` = `+`...
(7.5.8)
 

> `assign`(poly2, subs(sln2, poly1)); 1
 

`assign`(poly2, Matrix(%id = 207410744))
`assign`(poly2, Matrix(%id = 207410744))
`assign`(poly2, Matrix(%id = 207410744))
`assign`(poly2, Matrix(%id = 207410744))
(7.5.9)
 

> `assign`(eq3, D1OrthEqs(poly2, d, sqrt(d))); 1
 

 

Make sure that the mask a={a(k)} is normalized so that  sum_k a(k) = 1, i.e., subs(z=1,poly) = 1.
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
`assign`(eq3, {`+`(`*`(3, `*`(a101c2, `*`(`a201c-1`))), `*`(3, `*`(a101c1, `*`(`a201c-2`))), `*`(`/`(1, 3), `*`(a102c3)), `*`(3, `*`(a102c3, `*`(a202c3))), `*`(6, `*`(`^`(a102c3, 2))), `-`(`*`(`/`(1, ...
(7.5.10)
 

> `assign`(basis3, Groebner[Solve](eq3)); -1
 

> `assign`(sln3, solve(convert(basis3[12][1], set))); 1
 

`assign`(sln3, {a101c1 = `/`(1, 27), a101c2 = `/`(2, 27), a102c2 = -`/`(2, 27), a102c3 = 0, `a201c-1` = -`/`(14, 297), `a201c-2` = `/`(8, 297), a202c2 = `/`(67, 297), a202c3 = -`/`(2, 99)})
`assign`(sln3, {a101c1 = `/`(1, 27), a101c2 = `/`(2, 27), a102c2 = -`/`(2, 27), a102c3 = 0, `a201c-1` = -`/`(14, 297), `a201c-2` = `/`(8, 297), a202c2 = `/`(67, 297), a202c3 = -`/`(2, 99)})
(7.5.11)
 

> `assign`(poly3, subs(sln3, poly2)); 1
 

`assign`(poly3, Matrix(%id = 152370960)) (7.5.12)
 

> D1OrthEqs(poly3, d, sqrt(d)); 1
 

 

Make sure that the mask a={a(k)} is normalized so that  sum_k a(k) = 1, i.e., subs(z=1,poly) = 1.
(7.5.13)
 

> `assign`(res, D1MaskForMatlab(poly3)); 1
 

 

Note: After use res:=D1MaskForMatlabMatrix(poly), use CodeGeneration['Matlab'](res[1]); CodeGeneration['Matlab'](res[2]); To generate matlab matrices for the matlab code D1CriticalExponentV2.
Note: After use res:=D1MaskForMatlabMatrix(poly), use CodeGeneration['Matlab'](res[1]); CodeGeneration['Matlab'](res[2]); To generate matlab matrices for the matlab code D1CriticalExponentV2.
(7.5.14)
 

> CodeGeneration['Matlab'](res[1]); 1
 

cg = [-0.38e2 / 0.297e3 0 0.83e2 / 0.297e3 0.64e2 / 0.297e3 0.1e1 / 0.3e1 0.26e2 / 0.99e2 0.1e1 / 0.27e2 0 0.2e1 / 0.27e2 -0.2e1 / 0.27e2 0 0; 0.8e1 / 0.297e3 0 -0.14e2 / 0.297e3 -0.10e2 / 0.297e3 0 0.1e1 / 0.11e2 0.118e3 / 0.297e3 0.1e1 / 0.3e1 0.8e1 / 0.297e3 0.67e2 / 0.297e3 0 -0.2e1 / 0.99e2;];
 

> CodeGeneration['Matlab'](res[2]); 1
 

cg0 = [-2 -1 0 1 2 3];
 

>
 

> `assign`(tmp, solve(convert(basis3[14][1], set))); 1
 

`assign`(tmp, {a101c1 = `/`(5, 81), a101c2 = -`/`(4, 81), a102c2 = `/`(2, 81), a102c3 = 0, `a201c-1` = -`/`(10, 567), `a201c-2` = `/`(8, 567), a202c2 = -`/`(5, 567), a202c3 = 0})
`assign`(tmp, {a101c1 = `/`(5, 81), a101c2 = -`/`(4, 81), a102c2 = `/`(2, 81), a102c3 = 0, `a201c-1` = -`/`(10, 567), `a201c-2` = `/`(8, 567), a202c2 = -`/`(5, 567), a202c3 = 0})
(7.5.15)
 

> `assign`(sln4, allvalues(tmp)); 1
 

`assign`(sln4, {a101c1 = `/`(5, 81), a101c2 = -`/`(4, 81), a102c2 = `/`(2, 81), a102c3 = 0, `a201c-1` = -`/`(10, 567), `a201c-2` = `/`(8, 567), a202c2 = -`/`(5, 567), a202c3 = 0})
`assign`(sln4, {a101c1 = `/`(5, 81), a101c2 = -`/`(4, 81), a102c2 = `/`(2, 81), a102c3 = 0, `a201c-1` = -`/`(10, 567), `a201c-2` = `/`(8, 567), a202c2 = -`/`(5, 567), a202c3 = 0})
(7.5.16)
 

> `assign`(poly4, subs(sln4, poly2)); 1
 

`assign`(poly4, Matrix(%id = 187320416)) (7.5.17)
 

> D1OrthEqs(poly4, d, sqrt(d)); 1
 

 

Make sure that the mask a={a(k)} is normalized so that  sum_k a(k) = 1, i.e., subs(z=1,poly) = 1.
(7.5.18)
 

> `assign`(res, D1MaskForMatlab(poly4)); 1; CodeGeneration['Matlab'](res[1]); 1; CodeGeneration['Matlab'](res[2]); 1
 

 

 

Note: After use res:=D1MaskForMatlabMatrix(poly), use CodeGeneration['Matlab'](res[1]); CodeGeneration['Matlab'](res[2]); To generate matlab matrices for the matlab code D1CriticalExponentV2.
Note: After use res:=D1MaskForMatlabMatrix(poly), use CodeGeneration['Matlab'](res[1]); CodeGeneration['Matlab'](res[2]); To generate matlab matrices for the matlab code D1CriticalExponentV2.
`assign`(res, Matrix(%id = 196457792))
cg1 = [-0.44e2 / 0.567e3 0 0.55e2 / 0.567e3 0.220e3 / 0.567e3 0.1e1 / 0.3e1 0.2e1 / 0.9e1 0.5e1 / 0.81e2 0 -0.4e1 / 0.81e2 0.2e1 / 0.81e2; 0.8e1 / 0.567e3 0 -0.10e2 / 0.567e3 -0.40e2 / 0.567e3 0 0.1e1 / 0.9e1 0.190e3 / 0.567e3 0.1e1 / 0.3e1 0.172e3 / 0.567e3 -0.5e1 / 0.567e3;];
cg2 = [-2 -1 0 1 2];
 

>
 

>
 

>
 

>