Matvec Users’ Guide
Matvec Users' Guide
Matvec Users' Guide
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
9.3. SPECIAL MATRIX PACKAGE 55<br />
i = 1 i = 2 i = 3 i = 4<br />
2 3 5 7<br />
> prime_next(4)<br />
5<br />
> prime_next(888)<br />
907<br />
> prime_less(8)<br />
i = 1 i = 2 i = 3 i = 4<br />
2 3 5 7<br />
9.3 Special Matrix Package<br />
The macro package special matrix contains following special matrices:<br />
hadamard, pascal, toeplitz.<br />
hilb, invhilb, hankel, vander,<br />
9.3.1 hilb<br />
hilb(n) creates the Hilbert matrix of order n. The i, j element H(i,j) of a Hilbert matrix is defined as H(i,j)<br />
= 1 / (i + j - 1). For example,<br />
> package("special_matrix");<br />
> hilb(3)<br />
Col 1 Col 2 Col 3<br />
Row 1 1 0.5 0.333333<br />
Row 2 0.5 0.333333 0.25<br />
Row 3 0.333333 0.25 0.2<br />
9.3.2 invhilb<br />
invhilb(n) returns the inverse of the Hilbert matrix of order n. This is the exat results. See and compare<br />
invhilb(n) with hilb(n).inv(). For example,<br />
> package("special_matrix");<br />
> invhilb(3)<br />
9.3.3 hankel<br />
Col 1 Col 2 Col 3<br />
Row 1 9 -36 30<br />
Row 2 -36 192 -180<br />
Row 3 30 -180 180<br />
hankel(C) returns a square Hankel matrix whose first column is C and whose elements are zero below the<br />
first anti-diagonal; whereas hankel(C,R) returns a Hankel matrix whose first column is C and whose last<br />
row is R. Hankel matrices are symmetric, constant across the anti-diagonals, and have elements H(i,j) =<br />
R(i+j-1). For example,<br />
> package("special_matrix");<br />
> hankel([1,2,3])<br />
Col 1 Col 2 Col 3