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

Algebra Calculator

#### Mode_identity

Function: mode_identity (<arg_1>, <arg_2>) A special form used with `mode_declare` and `macros` to declare, e.g., a list of lists of flonums, or other compound data object. The first argument to `mode_identity` is a primitive value mode name as given to `mode_declare` (i.e., one of `float`, `fixnum`, `number`, `list`, or `any`), and the second argument is an expression which is evaluated and returned as the value of `mode_identity`. However, if the return value is not allowed by the mode declared in the first argument, an error or warning is signalled. The important thing is that the mode of the expression as determined by the Maxima to Lisp translator, will be that given as the first argument, independent of anything that goes on in the second argument. E.g., `x: 3.3; mode_identity (fixnum, x);` yields an error. `mode_identity (flonum, x)` returns 3.3 . This has a number of uses, e.g., if you knew that `first (l)` returned a number then you might write `mode_identity (number, first (l))`. However, a more efficient way to do it would be to define a new primitive,

firstnumb (x) ::= buildq ([x], mode_identity (number, x));

and use `firstnumb` every time you take the first of a list of numbers.

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

### Related Examples

? mode_identity;

Calculate

? identity;

Calculate

##### identity-matrix-phi

Cphi: matrix([1,0,0...

Ctheta: matrix([ct,0,...

Cpsi: matrix([cs,ss...

Calculate

##### identity-matrix

q:matrix([a11,a12,a13...

d:identity(4);

Calculate

##### identity-matrix-phi

Cphi: matrix([1,0,0...

Ctheta: matrix([ct,0,...

Cpsi: matrix([cs,ss...

Calculate

##### identity-matrix

A:matrix([.8,.1,.1],[...

A.A;

I:identity(3);

Calculate

kill(v1,v2,v2);

v1:[-1,0,1];

v2:[0,1,-1];

Calculate

##### identity-matrix-phi

Cphi: matrix([1,0,0...

Ctheta: matrix([ct,0,...

Cpsi: matrix([cs,ss...

Calculate

##### identity-matrix-phi

Cphi: matrix([1,0,0...

Ctheta: matrix([ct,0,...

Cpsi: matrix([cs,ss...

Calculate

? mode_identity;

Calculate