Ask Your Question

Revision history [back]

Computing the n-th power of a matrix, where n is a symbolic variable, is possible.

Using that, you could solve your problem as follows.

sage: J = matrix([[1, 0, 0], [0, -1/2-1/2*I, 0], [0, 0, -1/2 + 1/2*I]])
sage: n = SR.var('n')
sage: J^n
[               1                0                0]
[               0 (-1/2*I - 1/2)^n                0]
[               0                0  (1/2*I - 1/2)^n]
sage: J.parent()([lim(x, n=infinity) for x in (J^n).list()])
[1 0 0]
[0 0 0]
[0 0 0]

Computing the n-th power of a matrix, where n is a symbolic variable, is possible.

Using that, you could solve your problem as follows.

sage: J = matrix([[1, 0, 0], [0, -1/2-1/2*I, 0], [0, 0, -1/2 + 1/2*I]])
sage: n = SR.var('n')
sage: J^n
[               1                0                0]
[               0 (-1/2*I - 1/2)^n                0]
[               0                0  (1/2*I - 1/2)^n]
sage: J.parent()([lim(x, n=infinity) for x in (J^n).list()])
[1 0 0]
[0 0 0]
[0 0 0]

Edit: this is simpler and more readable:

sage: J = matrix([[1, 0, 0], [0, -1/2-1/2*I, 0], [0, 0, -1/2 + 1/2*I]])
sage: n = SR.var('n')
sage: (J^n).apply_map(lambda x: lim(x, n=oo))
[1 0 0]
[0 0 0]
[0 0 0]

Computing the n-th power of a matrix, where n is a symbolic variable, is possible.

Using that, you could solve your problem as follows.

sage: J = matrix([[1, 0, 0], [0, -1/2-1/2*I, 0], [0, 0, -1/2 + 1/2*I]])
sage: n = SR.var('n')
sage: J^n
[               1                0                0]
[               0 (-1/2*I - 1/2)^n                0]
[               0                0  (1/2*I - 1/2)^n]
sage: J.parent()([lim(x, n=infinity) for x in (J^n).list()])
[1 0 0]
[0 0 0]
[0 0 0]

Edit: this is simpler and more readable:

sage: J = matrix([[1, 0, 0], [0, -1/2-1/2*I, 0], [0, 0, -1/2 + 1/2*I]])
sage: n = SR.var('n')
sage: (J^n).apply_map(lambda x: lim(x, n=oo))
[1 0 0]
[0 0 0]
[0 0 0]

You could then define a function and apply it to any matrix.

sage: def limit_of_power(m):
....:     n = SR.var('n')
....:     return (m^n).apply_map(lambda x: limit(x, n=oo))
....: 
sage: limit_of_power(J)
[1 0 0]
[0 0 0]
[0 0 0]