[Maxima] more stupid errors
robert.dodier at gmail.com
Thu May 24 18:30:57 CDT 2007
On 5/24/07, Thomas Widlar <twidlar at yahoo.com> wrote:
> line: readline(f), words:split(line), nwords:length(words),
> to read the variables ii,jj,kk,nn.
I don't recommend this approach. (1) Let Maxima parse the file
for you, then process the parsed input. (2) Organize the program
such that in each step you take a blob of data and apply one
transform to it. Repeat until the blob has the form you want.
I am pretty sure that a list of 200,000 floats is not too large
for Maxima to handle as a single blob.
A rough outline of the program accordingly:
L1 : read_list ("my.data")$
L2 : makelist ([L1 [3*i - 2], L1 [3*i - 1], L1 [3*i]], i, 1, length(L1) / 3);
L3 : sublist (L2, lambda ([e], e # 0.0 or e # 0.0 or e3 # 0.0));
/* now L3 comprises the non-zero triples;
dunno what else needs to be done at this point */
If the data file contains 0 (i.e. not floating point 0.0) you'll need
to modify the last step accordiingly.
Note that this formulation avoids the use of for-loops.
Hope this helps.
More information about the Maxima