Function reference · Linear algebra

imatrix

Creates an identity matrix of the requested integer size.

For an integer n, imatrix creates an n by n Matrix with ones on the main diagonal and zeros elsewhere. A non-integer symbolic size remains as an unevaluated imatrix call.

Examples

These examples use Nerdamer Notation.

Create a 3 by 3 identity matrix.

imatrix(3)
// → matrix([1, 0, 0], [0, 1, 0], [0, 0, 1])

Interfaces

The same operation is available through the interfaces below.

Nerdamer Notation · nerdamer API · Direct API

Nerdamer Notation

Use this form inside input passed to nerdamer(...).

imatrix(arg1)

nerdamer.imatrix

Call the operation through the default nerdamer import.

nerdamer.imatrix(x: Expression): Expression | Matrix

Parameters

NameTypeDescription
xExpression

Returns

Expression | Matrix — A Matrix for an integer argument, or an unevaluated `imatrix(x)` Expression when the size is not an integer.

Browse the nerdamer API →

Direct JavaScript / TypeScript API

Import the operation directly from its package entry point.

import { imatrix } from 'nerdamer/structures';
imatrix(x: Expression): Expression | Matrix

Parameters

NameTypeDescription
xExpression

Returns

Expression | Matrix — A Matrix for an integer argument, or an unevaluated `imatrix(x)` Expression when the size is not an integer.

Browse nerdamer/structures

← Back to Reference