Skip to main content

agentchat.contrib.captainagent.tools.math.calculate_matrix_power

calculate_matrix_power

@with_requirements(["sympy"])
def calculate_matrix_power(matrix, power)

Calculate the power of a given matrix.

Arguments:

  • matrix list - An array of numbers that represents the matrix.
  • power int - The power to which the matrix is raised.

Returns:

  • Matrix - The resulting matrix after raising to power.

Raises:

  • ValueError - If the power is negative and the matrix is not invertible.