# matrix_function function

A function of a square matrix.

## How to write it

### matrix_function(f, matrix)

**f**

The function, such as exp. Takes a function.

**matrix**

A square matrix. Takes a matrix, written as a list of rows.

## Examples

- $\displaystyle \operatorname{matrix\_function}\left(\exp, \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix}\right) = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$

  `matrix_function(exp, [[0, 0], [0, 0]])`

  In the solver, `matrix_function(exp, [[0, 0], [0, 0]])` gives `[[1, 0], [0, 1]]`.

  [Open in the solver](https://hilberon.com/?q=matrix_function%28exp%2C%20%5B%5B0%2C%200%5D%2C%20%5B0%2C%200%5D%5D%29)

## Related functions

- [matrix_log](https://hilberon.com/library/matrix_log)

  Logarithm of a square matrix.
- [matrix_exp](https://hilberon.com/library/matrix_exp)

  Exponential of a square matrix.
- [matrix_power](https://hilberon.com/library/matrix_power)

  A square matrix to a whole power.
- [identity_matrix](https://hilberon.com/library/identity_matrix)

  Identity matrix of a given size.
- [hilbert_matrix](https://hilberon.com/library/hilbert_matrix)

  Hilbert matrix of a given size: the entry in row i and column j is 1/(i + j - 1).
- [diagonal_matrix](https://hilberon.com/library/diagonal_matrix)

  A matrix with the given list on its diagonal and zeros elsewhere.

---
Source: https://hilberon.com/library/matrix_function
