Next: Operations on univariate polynomials Up: An introduction to Computer Algebra Previous: Operations on real numbers

## Operations on matrices

AXIOM SESSIONscale=2.5]

```N := PositiveInteger

(1)  PositiveInteger
Type: Domain
Time: 0 sec

D := DoubleFloat

(2)  DoubleFloat
Type: Domain
Time: 0 sec

F := Float

(3)  Float
Type: Domain
Time: 0 sec

Q := Fraction Integer

(4)  Fraction Integer
Type: Domain
Time: 0 sec

HilbertMatrixD(n:N): Matrix  D == _
matrix([[1.0/(i + j) for i in 1..n] for j in 1..n])

Type: Void
Time: 0.01 (IN) = 0.01 sec

HilbertMatrixF(n:N): Matrix  F == _
matrix([[1.0/(i + j) for i in 1..n] for j in 1..n])

Type: Void
Time: 0.01 (IN) = 0.01 sec

HilbertMatrixQ(n:N): Matrix  Q == _
matrix([[1/(i + j) for i in 1..n] for j in 1..n])

Type: Void
Time: 0 sec

HilbertMatrixD(3)

+       0.5         0.333333333333333        0.25       +
|                                                       |
(8)  |0.333333333333333        0.25                0.2       |
|                                                       |
+      0.25                0.2         0.166666666666667+
Type: Matrix DoubleFloat
Time: 0.04 (IN) + 0.03 (OT) + 0.01 (GC) = 0.08 sec

HilbertMatrixQ(3)

+1  1  1+
|-  -  -|
|2  3  4|
|       |
|1  1  1|
(9)  |-  -  -|
|3  4  5|
|       |
|1  1  1|
|-  -  -|
+4  5  6+
Type: Matrix Fraction Integer
Time: 0.02 (OT) = 0.02 sec

HilbertMatrixF(3)

(10)
+          0.5            0.3333333333 3333333333           0.25          +
|                                                                         |
|0.3333333333 3333333333           0.25                      0.2          |
|                                                                         |
+         0.25                      0.2            0.1666666666 6666666667+
Type: Matrix Float
Time: 0.01 (IN) + 0.01 (OT) + 0.01 (GC) = 0.03 sec

[determinant(HilbertMatrixD(5*n)) for n in 1..6]

(11)
[1.4878155287776663e-14, 1.1708847390332544e-58, - 7.329551900980472e-127,
1.8972182407450097e-202, - 1.7767073603611213e-280, 0.0]
Type: List DoubleFloat
Time: 0.43 (IN) + 0.14 (EV) + 0.06 (OT) = 0.63 sec

[determinant(HilbertMatrixF(5*n)) for n in 1..6]

(12)
[0.1487815528 7758289063 E -13, 0.1171371536 8024357091 E -57,
0.8781685580 3800165504 E -132, 0.4005398450 3281293592 E -224,
- 0.8672044362 0589913695 E -319, 0.1929750883 9978983829 E -417]
Type: List Float
Time: 0.48 (EV) + 0.10 (GC) = 0.58 sec

[determinant(HilbertMatrixQ(5*n)) for n in 1..6]

(13)
1                                     1
[--------------, ----------------------------------------------------------,
67212633600000  8537000898240926708833515201784986712482596782080000000000

1
/
146538740183666877481333971725269067959384123502368457086504025547136338_
7281567173259185477862791557143607640064000000000000000000000
,

1
/
327723880133278729476665890222832025204546816520485699917379710978406689_
52779223214483748651170263631423109857464822124939490164270836312516034_
15239472195372333133701896827240771248538377176401848565760000000000000_
00000000000000000000000
,

1
/
943443458848441228956693696279760730359903469457936499731851074111615233_
14255514417225236246776078681522617448130111877369572484796897612065933_
52237684747328030203084672090167556606865123046915733557035025165367211_
81161075206120441411355364487536402146184314196057700767052024312362680_
20442693962925170374671475057413324800000000000000000000000000000000000_
000000000000000
,

1
/
347678097173631327706181116037484788665140455596751194236374423476934278_
72336185915903600949727565688512425687551728790953230983654612947880686_
64034084877513911919412368602956835751833985175217203858528427028478411_
07420065708261775033449064671483311289619473162541454992338969245601369_
24601181973306894033338133775362887249764402725843635016814711320344415_
32672272163948431375908684874930724465894995883925403831087253290653960_
68715359788388174845939833221273153240082092406289203200000000000000000_
00000000000000000000000000000000000000
]
Type: List Fraction Integer
Time: 0.31 (EV) + 0.01 (OT) = 0.32 sec

h6F := HilbertMatrixF(6)

(14)
[
[0.5, 0.3333333333 3333333333, 0.25, 0.2, 0.1666666666 6666666667,
0.1428571428 5714285714]
,

[0.3333333333 3333333333, 0.25, 0.2, 0.1666666666 6666666667,
0.1428571428 5714285714, 0.125]
,

[0.25, 0.2, 0.1666666666 6666666667, 0.1428571428 5714285714, 0.125,
0.1111111111 1111111111]
,

[0.2, 0.1666666666 6666666667, 0.1428571428 5714285714, 0.125,
0.1111111111 1111111111, 0.1]
,

[0.1666666666 6666666667, 0.1428571428 5714285714, 0.125,
0.1111111111 1111111111, 0.1, 0.0909090909 0909090909 1]
,

[0.1428571428 5714285714, 0.125, 0.1111111111 1111111111, 0.1,
0.0909090909 0909090909 1, 0.0833333333 3333333333 3]
]
Type: Matrix Float
Time: 0.02 (OT) = 0.02 sec
h6F * inverse(h6F)

(15)
[[1.0,- 0.4 E -14,0.1 E -13,- 0.4 E -13,0.2 E -13,- 0.5 E -14],
[0.6 E -16,0.9999999999 99999,0.2 E -14,- 0.2 E -13,0.0,- 0.7 E -14],
[0.6 E -16,- 0.2 E -14,1.0,- 0.2 E -13,0.7 E -14,- 0.4 E -14],
[0.6 E -16,- 0.2 E -14,0.5 E -14,0.9999999999 9998,0.0,- 0.5 E -14],
[0.7 E -16,- 0.1 E -14,0.0,- 0.2 E -13,1.0,- 0.4 E -14],
[0.3 E -16,- 0.9 E -15,0.4 E -14,- 0.1 E -13,0.7 E -14,1.0]]
Type: Matrix Float
Time: 0.01 (EV) + 0.01 (OT) = 0.02 sec

h6Q := HilbertMatrixQ(6)

+1  1  1  1   1   1 +
|-  -  -  -   -   - |
|2  3  4  5   6   7 |
|                   |
|1  1  1  1   1   1 |
|-  -  -  -   -   - |
|3  4  5  6   7   8 |
|                   |
|1  1  1  1   1   1 |
|-  -  -  -   -   - |
|4  5  6  7   8   9 |
(16)  |                   |
|1  1  1  1   1    1|
|-  -  -  -   -   --|
|5  6  7  8   9   10|
|                   |
|1  1  1  1    1   1|
|-  -  -  -   --  --|
|6  7  8  9   10  11|
|                   |
|1  1  1   1   1   1|
|-  -  -  --  --  --|
+7  8  9  10  11  12+
Type: Matrix Fraction Integer
Time: 0 sec
h6Q * inverse(h6Q)

+1  0  0  0  0  0+
|                |
|0  1  0  0  0  0|
|                |
|0  0  1  0  0  0|
(17)  |                |
|0  0  0  1  0  0|
|                |
|0  0  0  0  1  0|
|                |
+0  0  0  0  0  1+
Type: Matrix Fraction Integer
Time: 0.01 (IN) = 0.01 sec

[determinant(HilbertMatrixF(5*n)) for n in 1..10];

Type: List Float
Time: 3.02 (EV) + 0.29 (GC) = 3.31 sec

[determinant(HilbertMatrixQ(5*n)) for n in 1..10];

Type: List Fraction Integer
Time: 2.96 (EV) + 0.38 (GC) = 3.34 sec

[determinant(HilbertMatrixF(5*n)) for n in 1..15];

Type: List Float
Time: 0.01 (IN) + 14.09 (EV) + 1.59 (GC) = 15.69 sec

[determinant(HilbertMatrixQ(5*n)) for n in 1..15];

Type: List Fraction Integer
Time: 19.41 (EV) + 2.75 (GC) = 22.16 sec

[determinant(HilbertMatrixF(5*n)) for n in 1..20];

Type: List Float
Time: 42.99 (EV) + 5.07 (GC) = 48.06 sec

[determinant(HilbertMatrixQ(5*n)) for n in 1..20];

Type: List Fraction Integer
Time: 75.55 (EV) + 11.16 (GC) = 86.71 sec
```

Next: Operations on univariate polynomials Up: An introduction to Computer Algebra Previous: Operations on real numbers
Marc Moreno Maza
2003-06-06