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

Algebra Calculator

#### 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-linsolve-num

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

declare(x, integerval...

declare(y, integerval...

Calculate

##### declare-diff-exp

declare(lambda,scalar);

u:exp(-lambda*(x*x + ...

f:diff(diff(u,x),x) +...

Calculate

##### declare-expand-sqrt

declare([x,y],[scalar...

L:sqrt((x-x1)^2+(y-y1...

L2:L^2;

Calculate

##### declare-float-solve-sqrt

a:solve(T1^2*a^2-a-10...

declare([T1,a], real);

w=float(sqrt(a));

Calculate

##### declare-inf-limit

declare (n, integer);

a:(3^n+5^n+7^n);

limit(a,n,inf);

Calculate

##### declare-diff-expand-linear-solve-sum

f(a,b):=sum((y[i]-a*x...

f1:diff(f(a,b),a)=0,e...

f2:diff(f(a,b),b)=0,e...

Calculate

dotconstrules:true;

Calculate

##### declare

declare(x,integer);

declare(y,integer);

Calculate

##### declare-noun

declare ( f, noun );

f: x^2+x+1;

factorize ( f );

Calculate