Opened 4 years ago

Closed 4 years ago

#25082 closed defect (fixed)

Fix symbolic power of matrix

Reported by: slelievre Owned by:
Priority: major Milestone: sage-8.2
Component: linear algebra Keywords: matrix power, symbolic
Cc: mforets, slelievre, tmonteil, tscrim Merged in:
Authors: Samuel Lelièvre Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: fcee945 (Commits, GitHub, GitLab) Commit: fcee945ea54fad3483fbb5c6c46d3fe4362f9ea9
Dependencies: Stopgaps:

Status badges


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]

Change History (5)

comment:1 Changed 4 years ago by slelievre

  • Cc mforets tscrim added

Cc-ing authors and reviewers of #22523.

I pushed the fix from my answer at Ask Sage.

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


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.