Sponsored links: Algebra eBooks

### The Maxima on-line user's manual

Algebra Calculator

#### Diagmatrix

Function: diagmatrix (<n>, <x>) Returns a diagonal matrix of size <n> by <n> with the diagonal elements all equal to <x>. `diagmatrix (<n>, 1)` returns an identity matrix (same as `ident (<n>)`).

<n> must evaluate to an integer, otherwise `diagmatrix` complains with an error message.

<x> can be any kind of expression, including another matrix. If <x> is a matrix, it is not copied; all diagonal elements refer to the same instance, <x>.

There are also some inexact matches for `diagmatrix`. Try `?? diagmatrix` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### diagmatrix-ident-matrix

B:matrix([1,-1,2],[0,...

B[2][3];

C:diagmatrix(3,2);

Calculate

##### diagmatrix-eigenvalues-load-matrix

m:matrix([1,0,0,0],[0...

load(eigen);

CA:matrix(eigenvalues...

Calculate

##### diagmatrix-expand-jacobian-matrix-phi-ratsimp-sin

A:matrix([0,-1/L1,0],...

B:matrix([1/L1, 0], [...

x:matrix([i_inv],[u_c...

Calculate

##### diagmatrix-matrix

A:matrix([0,-1/L1,0],...

x: diagmatrix(3,1) + ...

Calculate

##### diagmatrix

n : 5;

m:diagmatrix(n,1-n);

Calculate

##### diagmatrix-eigenvalues-false-invert-load-rateinstein-ratfac-ratriemann-sin-true

load(ctensor);

/* defino los flags *...

ratchristof: true;

Calculate

##### diagmatrix-matrix

x: matrix ([6,2,-2], ...

i: diagmatrix (3, a);

Calculate

##### diagmatrix-expand-jacobian-matrix-phi-sin

A:matrix([0,-1/L1,0],...

B:matrix([1/L1, 0], [...

x:matrix([i_inv],[u_c...

Calculate

##### diagmatrix

a: diagmatrix(10,0);

a[1,1]: 1;

a[2,2]: 1;

Calculate

##### diagmatrix-matrix-mod

M: matrix ([7, 3, 4, ...

K : mod(M,11);

D:diagmatrix(4,1)*k;

Calculate