Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » Matrix » inverse(Matrix)
next | previous | forward | backward | up | index | toc

# inverse(Matrix) -- compute the inverse

- Function: inverse
- Usage:
    `inverse f`
- Inputs:
  - f, a matrix, a mutable matrix, or a ring map,
- Outputs:
  - a matrix, a mutable matrix, or a ring map, the inverse of f

## Code

    ../../m2/methods.m2:693:25-693:88: --source code:
    cacheValue = key -> f -> x -> ( try x.cache else x.cache = new CacheTable )#key ??= f(x)
    | symbol  class            value                                              location of symbol
    | ------  -----            -----                                              ------------------
    | f       FunctionClosure  FunctionClosure[../../m2/matrix1.m2:631:5-637:19]  ../../m2/methods.m2:693:20-693:21
    | key     Symbol           inverse                                            ../../m2/methods.m2:693:13-693:16
    | -- function f:
    | ../../m2/matrix1.m2:631:5-637:19: --source code:
    |      m -> (
    |       if hasEngineLinearAlgebra ring m and isBasicMatrix m then
    |           basicInverse m
    |       else (
    |               (quo,rem) := quotientRemainder(id_(target m), m);
    |               if rem != 0 then error "matrix not invertible";
    |               quo))

### Menu

- InverseMethod -- compute reciprocals

## Ways to use this method:

- inverse(Matrix) -- compute the inverse
- `inverse(MutableMatrix)`
- `inverse(RingMap)`

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/inverse-doc.m2:27:0.