Opened 4 years ago

Closed 4 years ago

# Fix symbolic power of matrix

Reported by: Owned by: slelievre major sage-8.2 linear algebra matrix power, symbolic mforets, slelievre, tmonteil, tscrim Samuel Lelièvre Frédéric Chapoton N/A fcee945 fcee945ea54fad3483fbb5c6c46d3fe4362f9ea9

### Description

The symbolic power of a matrix was requested and discussed in Ask Sage question 25658, and implemented in #22523.

That implementation works in basic cases (diagonalizable case, two by two case, ...).

As reported in Ask Sage question 41622 though, it fails in some cases.

The reason is that the general matrix power is computed on the Jordan form of the matrix, but the k-th block was placed at (k, k), which is incorrect if a Jordan block of size at least two occurs in any position but the last.

This ticket implements the fix suggested in an answer to Ask Sage question 41622.

Before this ticket:

```sage: n = SR.var('n')
sage: A = matrix(QQ, 3, [[2, 1, 0], [0, 2, 0], [0, 0, 3]]); A
sage: B = A^n; B
[        2^n 2^(n - 1)*n           0]
[          0         3^n           0]
[          0           0           0]
```

After this ticket:

```sage: B = A^n; B
[        2^n 2^(n - 1)*n           0]
[          0         2^n           0]
[          0           0         3^n]
```

### comment:1 Changed 4 years ago by slelievre

Cc-ing authors and reviewers of #22523.

### comment:2 Changed 4 years ago by slelievre

• Status changed from new to needs_review

### comment:3 Changed 4 years ago by chapoton

• Reviewers set to Frédéric Chapoton
• Status changed from needs_review to positive_review

ok

### comment:4 Changed 4 years ago by mforets

thanks for the fix.

### comment:5 Changed 4 years ago by vbraun

• Branch changed from u/slelievre/fix_symbolic_power_of_matrix to fcee945ea54fad3483fbb5c6c46d3fe4362f9ea9
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.