Formatted input and output to files.
See also the Euler core functions for file input and output in Euler Core.
For files of unknown sources getmatrix or getvector should be used to read the numerical content. For output, writematrix is the easiest choice.
The functions work either for files opened with open(), or for a file name provided as a parameter, or for terminal output.
For Latex, writelatex can be used.
function getmatrix (n:real scalar, m:real scalar, filename:string="") Read a real nxm Matrix from the file. If the filename is "", the file must be opened before. Else the file will open and close for read. Matrix values must be decimal fix point numbers with a dot (not a comma). They must be stored row after row. See:
getvector (Euler Core),
open (Euler Core)
function readmatrix (filename:string="", max=1000, expand=0) Read a real matrix from the file. The matrix is stored row by row in lines, with an empty line ending the matrix. If the filename is not empty, the function will open the file for reading, and close it after reading. Otherwise, it will use the provided file name. max is the maximimal number of columns. If expand is true incomplete lines will filled with 0. See:
writematrix (Elementary File Input and Output),
open (Euler Core),
close (Euler Core),
close (Maxima Documentation),
getmatrix (Elementary File Input and Output)
function getmatrixlines (filename:string="", max=1000, expand=0) Obsolete. Use readmatrix. See:
readmatrix (Elementary File Input and Output)
function writematrix (v:real, filename:string="", format:string="%0.16f") Write a real nxm Matrix to the file row after row. If the filename is not "", the file will be created (beware!), opened, and closed after writing. If the filename is "", a file opened with open(filename,"w") will be used, or the terminal. See:
open (Euler Core)
function writef (x, f:string="%g", sep1:string=", ", sep2:string="; ") Print the vector x formatted with format f to the open file. The format is applied to real and imaginary part, or lower and upper part of the elements of x. See:
printf (Euler Core),
printf (Maxima Documentation),
open (Euler Core)
function writeform (x, format="%0.16g") Converts x in the specified format to a string
function writevar (x,s="",filename="",newlines=0) Write a variable Euler syntax. If a filename is given, or a file is open, it will be used, otherwise the function will write to the command line. s : the name of the variable filename : a file to write to newlines : flag for newlines to separate elements in a row
function writeformat (x,f="%g",sep1=", ",sep2=";", .. writereal=1,ibracket1="~",ibracket2="~",perline=100) Print the vector x formatted with format f. The format is applied to real and imaginary part, or lower and upper part of the elements of x. writeral : Complex and interval values become two real values. Rows are separated with sep2. If a file is open, the function will write to that file. See:
writevar (Elementary File Input and Output)
Latex is a text system for mathematical texts. Sometimes, you may wish to output Euler matrices in Latex. Symbolic matrices can be printed using the latex command of Maxima.
function writelatex (x,f="%g",environment="pmatrix",perline=100) Write x for AMS latex matrix environment This function can output an Euler matrix for the AMS Latex environment pmatrix, or any other environment. The open file is used, or the terminal. perline: Maximal number of items per line See:
writeformat (Elementary File Input and Output),
open (Euler Core)
Use the dir command to get a listing of the files in the active directory. This is the directory, where the notebook is stored. It can be changed using the changedir command in Euler Core.
function dir (pattern:string=none, dirs:integer=false) vector of strings with matching file names or subdirectories. The pattern can be something like "*.en" or "file?.dat" If dirs==true, then only directories will be listed. Directories are listed with a "/" at the end. See:
changedir (Euler Core),
searchfile (Euler Core)