Previous: Using MAXIMA for Typesetting Up: Basic Information on Running Maxima Next: Other Useful Things

Fortran Code Generation

The FORTRAN command in MAXIMA can be used to generate formulas and matrices into fortran code for inclusion in fortran programs. This is very convenient. However this FORTRAN command does not work well with larger formulas. We have developed at KSU a command "f77" which should be used instead to produce fortran code from MAXIMA expressions. The f77 command takes one or two arguments. The first argument can be an expression or the name of an expression. The second argument is a file name where the fortran code shall be stored, in stead of being sent to the terminal. In the following examples, exp is an expression, mat is the name of a matrix, name is the desired fortran array name.


f77(exp);
f77('mat);
f77(name=mat);
f77(xu(1,2)=mat[1,2]);
There is a more complete fortran code generator called GENTRAN. This package can be loaded into MAXIMA and then you can produce f77, Ratfor or C code by translating Maxima constructs.

There is a later package called Gencray which is much faster and can generate f77 or Cray fortran codes.

farrell@mcs.kent.edu