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:

Translate

Function: translate (<f_1>, ..., <f_n>)

Function: translate (functions)

Function: translate (all) Translates the user-defined functions <f_1>, ..., <f_n> from the Maxima language into Lisp and evaluates the Lisp translations. Typically the translated functions run faster than the originals.

translate (all) or translate (functions) translates all user-defined functions.

Functions to be translated should include a call to mode_declare at the beginning when possible in order to produce more efficient code. For example:

f (x_1, x_2, ...) := block ([v_1, v_2, ...], mode_declare (v_1, mode_1, v_2, mode_2, ...), ...)

where the <x_1>, <x_2>, ... are the parameters to the function and the <v_1>, <v_2>, ... are the local variables.

The names of translated functions are removed from the functions list if savedef is false (see below) and are added to the props lists.

Functions should not be translated unless they are fully debugged.

Expressions are assumed simplified; if they are not, correct but non-optimal code gets generated. Thus, the user should not set the simp switch to false which inhibits simplification of the expressions to be translated.

The switch translate, if true, causes automatic translation of a users function to Lisp.

Note that translated functions may not run identically to the way they did before translation as certain incompatabilities may exist between the Lisp and Maxima versions. Principally, the rat function with more than one argument and the ratvars function should not be used if any variables are mode_declared canonical rational expressions (CRE). Also the prederror: false setting will not translate.

savedef - if true will cause the Maxima version of a user function to remain when the function is translated. This permits the definition to be displayed by dispfun and allows the function to be edited.

transrun - if false will cause the interpreted version of all functions to be run (provided they are still around) rather than the translated version.

The result returned by translate is a list of the names of the functions translated.

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

(%o1)                                true
(%i2) 

Related Examples

translate

? declare_translate;

Calculate

translate

f[x] := x;

translate (f);

f[1];

Calculate

translate

test (x) := ( if x...

test(3);

translate(test);

Calculate

translate

test (x) := ( if x...

test(3);

translate(test(6));

Calculate

translate

test (x) := ( if x...

test(3);

translate(test);

Calculate

translate

test (x) := ( if x...

test(3);

translate(test(x));

Calculate

translate

f(x) := x;

translate (f);

Calculate

translate

test (x) := ( if x...

test(3);

translate(test(6));

Calculate

translate

f(x) := x;

translate (f);

f(1);

Calculate

translate

test (x) := ( if x...

test(3);

translate(test);

Calculate