Skip to content

Commit

Permalink
Modified the doctest and changed the comment
Browse files Browse the repository at this point in the history
Updated the old doctests which were failing before and updated the comment
to make it more readable.
  • Loading branch information
RuchitJagodara committed Dec 14, 2023
1 parent bcb27d6 commit 700f425
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sage/matrix/matrix2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -18601,7 +18601,6 @@ def _matrix_power_symbolic(A, n):
[ 1/2*2^(2*n + 1) + 1/2*kronecker_delta(0, 2*n + 1) -1/2*2^(2*n + 1) + 1/2*kronecker_delta(0, 2*n + 1)]
[-1/2*2^(2*n + 1) + 1/2*kronecker_delta(0, 2*n + 1) 1/2*2^(2*n + 1) + 1/2*kronecker_delta(0, 2*n + 1)]


Check if :trac:`23215` is fixed::

sage: a, b, k = var('a, b, k') # needs sage.symbolic
Expand All @@ -18619,7 +18618,7 @@ def _matrix_power_symbolic(A, n):
[0 0]
sage: n = var('n'); n
n
sage: An = A^n; An
sage: B = A^n; B
[ kronecker_delta(0, n) n*kronecker_delta(1, n)]
[ 0 kronecker_delta(0, n)]
"""
Expand Down Expand Up @@ -18662,7 +18661,10 @@ def _matrix_power_symbolic(A, n):
if hasattr(mk, 'radical_expression'):
mk = mk.radical_expression()

# Return mk^(n-i) instead of mk**(n-i) if mk=0

# When the variable "mk" is equal to zero, it is advisable to employ the Kronecker delta function
# instead of utilizing the numerical value zero. This choice is made to encompass scenarios where
# the power of zero is also equal to zero.
if mk:
vk = [(binomial(n, i) * mk._pow_(n-i)).simplify_full()
for i in range(nk)]
Expand Down

0 comments on commit 700f425

Please sign in to comment.