Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Mode_declare

Function: mode_declare (<y_1>, <mode_1>, ..., <y_n>, <mode_n>) `mode_declare` is used to declare the modes of variables and functions for subsequent translation or compilation of functions. `mode_declare` is typically placed at the beginning of a function definition, at the beginning of a Maxima script, or executed at the interactive prompt. The arguments of `mode_declare` are pairs consisting of a variable and a mode which is one of `boolean`, `fixnum`, `number`, `rational`, or `float`. Each variable may also be a list of variables all of which are declared to have the same mode.

If a variable is an array, and if every element of the array which is referenced has a value then `array (yi, complete, dim1, dim2, ...)` rather than array(yi, dim1, dim2, ...) should be used when first declaring the bounds of the array. If all the elements of the array are of mode `fixnum` (`float`), use `fixnum` (`float`) instead of `complete`. Also if every element of the array is of the same mode, say `m`, then

mode_declare (completearray (yi), m))

should be used for efficient translation.

Numeric code using arrays might run faster by declaring the expected size of the array, as in:

mode_declare (completearray (a [10, 10]), float)

for a floating point number array which is 10 x 10.

One may declare the mode of the result of a function by using `function (f_1, f_2, ...)` as an argument; here `f_1`, `f_2`, ... are the names of functions. For example the expression,

mode_declare ([function (f_1, f_2, ...)], fixnum)

declares that the values returned by `f_1`, `f_2`, ... are single-word integers.

`modedeclare` is a synonym for `mode_declare`.

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

### Related Examples

##### declare-nonscalar

declare(A, nonscalar);

Calculate

##### declare

declare(q,scalar);

Calculate

##### declare-let

:lisp (let ((x 1) (y ...

Calculate dotconstrules:true;

Calculate

##### declare-solve-subst

eq1:x*9+y*5=14;

declare(x, integerval...

declare(y, integerval...

Calculate

##### declare-limit-scalarp

declare(a,scalar);

scalarp(a);

scalarp(X);

Calculate dotconstrules:true;

Calculate

##### declare-dotscrules-expand-true

declare(theta,scalar,...

declare(T12, nonscala...

dotscrules:true;

Calculate

##### declare-elementp

declare(a, real);

elementp({2},{a});

Calculate

##### declare-let-optimize

:lisp #.(declaim (opt...

Calculate 