Compute the characteristic polynomial of a matrix
stm_charpoly.Rd
stm_charpoly()
calculates the characteristic polynomial of a square
matrix and optionally returns the polynomial as an equation.
Arguments
- x
A square matrix for which the characteristic polynomial will be computed.
- equation
Logical. If
TRUE
, the polynomial is returned as a string equation. Default isFALSE
.- variable
A string specifying the variable to be used in the polynomial. Default is
"x"
.- digits
Optional. An integer specifying the number of decimal places to round the result. Default is
NULL
, which means no rounding.
Value
A numeric vector of polynomial coefficients or a string representation
of the polynomial if equation = TRUE
.
Details
The function calculates the characteristic polynomial of a square matrix
using pracma::charpoly()
. If equation = TRUE
, the coefficients
are formatted as a polynomial equation.