[Maxima] Read_array Question

Robert Dodier robert.dodier at gmail.com
Sat Jan 7 15:35:16 CST 2012


On 12/31/11, Thomas D. Dean <tomdean at speakeasy.org> wrote:

> The data is
> Qth 23 41 a+bx
> Z9  3  7  41
>
> or,
> <name> number number <maxima expression>

> I want to read this file into maxima.

Well, there are a couple of functions to read data from a file
when the number of rows isn't known ahead of time.

read_matrix reads all the lines and creates a matrix with that many rows.

read_hashed_array reads the first item on each line and uses
that as a hash key for the remaining items on the line.
It returns an "undeclared array" (Maxima terminology for
a hash table).

But a problem is that the various read_* functions treat
each token as a separate item. E.g. a + b is read as two
items, a and +b. If your data contain some general expressions,
you will probably have to read line by line and play some games
with the parser.

Sorry for the late reply, hope this helps.

Robert Dodier


More information about the Maxima mailing list