Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

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.

mode_declare(myint,integer);
myint:1;
f(x):=myint;
compile(f);

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-diff-linear-solve-sum

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

f1:diff(f(a,b),a)=0;

f2:diff(f(a,b),b)=0;

Calculate

declare-limit

declare(a,scalar);

declare(T12, nonscala...

I(X):=(X^^(-1));

Calculate

declare-diff-linear-solve-sum

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

f1:diff(f(a,b),a)=0;

f2:diff(f(a,b),b)=0;

Calculate

declare-inf-limit

declare (n, integer);

%a:(4*n^2+5*n-7)^0.5-...

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

Calculate

declare-limit-scalarp

declare(a,scalar);

scalarp(a);

scalarp(X);

Calculate

declare-evfun-load

load(vector);

T(x):=x*y^2;

setcoord(c[x, y, z]);

Calculate

declare-dotconstrules-evfun-load-plot3d-true
plot3d(T(x), [x, 0, 4],[y, 0, 4]);

load(vect);

load(vector);

dotconstrules:true;

Calculate

declare-dotscrules-expand-true

declare(a,scalar);

declare(T12, nonscala...

dotscrules:true;

Calculate

declare-expand-mainvar

expand((0,2*x^3+0,1*x...

declare(x,mainvar);

Calculate

declare-expand-mainvar

expand((x^2-2*y^3)^3);

declare(x,mainvar);

Calculate