Sie sind auf Seite 1von 1

Maxima, wxMaxima

compile( all ) is a very important tool in Maxima for numerical calculations.


It compiles the functions written by the user and fastens the calculations sometimes
even hundreds of times. Nevertheless, this tool works bit unclear if combined with the
mode_declare and using arrays (some extra care must be taken into account).
mode_declare( ... ) may be important for using it with compile() in the calcu-
lation times of point of view. There exists a problem for arrays, that suggested method
mode_declare( completearray(x[N]), oat ) does not work inside the user function (ar-
rays work if you do not declare them or use array( x ) which does nothing else useful
than helps to read the code). If using arrays, then N must not be declared oat but had
to be declared xnum instead. If it is needed to divide with N , then it is wise to use
new parameter M : oat(N) and later mode_declare( [ M ] , oat , [ N ] , xnum ) .
Not declaring N at all may give some serious drawback for calculation times.
make_array( onum , N ) is better than array( name , onum , N ) or array(
name , N ). The reason behind this is that compile() may not work correctly for the last
two orders (if you need to pass arrays through the parameters of the user functions).
For numerical calculations, arrays work times and times quicker than lists. The prob-
lem is that lists are natural language elements for Maxima but arrays may not work in
every situation.
Using double FOR instead of double sums works way better combined with
PP

compile(). Without compile() double sums are quicker than double FOR.
Dividing may be noticeably slower than multiplication if not using compile() and
mode_declare(), otherwise the dierence is not important.
Linking much for functions and arrays or lists take noticeable extra time in Maxima.
Without compile() it is a serious time wasting method. Sometimes recalculating simpler
formulas is more eective than using already saved values.
Array function x[i] := may be very eective, if the algorithm for calculating x is an
iteration, otherwise it is better to use arrays with compiling the code.

Das könnte Ihnen auch gefallen