>>>>> Well, there are various instances of { and } in the place of ( and ) here. Those also need to be replaced.
D'oh again! Thanks. They are hard to see. I had no intention of putting
them, I am fully aware of maxima's use of (). [], and {}.
Another problem. I am using my readword() function to read numbers from
my bloated
test data file. It uses these commands,
line: readline(f), words:split(line), nwords:length(words),
nlines:nlines+1;
to read the variables ii,jj,kk,nn. The correct values 33,33,33,2 are
read in which
I can check from the command line. But somehow this is not a format that
the
for command can use.
nn is 2. But when I enter the command
(%i74) for n:1 thru nn do print(n);
Maxima was unable to evaluate the predicate:1>2 -- an error.
To debug this try debugmode(true);
But when I reset nn by hand it works.
(%i75) nn:2;
(%o75) 2
(%i76) for n:1 thru nn do print(n);
1
2
What do I have to do to the numbers I read in (evidently as strings) so they
can be used as numbers.
Robert Dodier wrote:
>On 5/24/07, Thomas Widlar <twidlar at yahoo.com> wrote:
>
>
>
>> for k:1 thru kk do
>> {
>> vx : readword(f),
>> vy : readword(f),
>> vz : readword(f),
>> nvr : nvr + 1,
>> if (nwords < 0) then go(xeof), /* EOF */
>> if vx # 0 or vy # 0 or vz # 0 then
>> (
>> vv : cons(vector([x,y,z],[vx,vy,vz]),vv),
>> nv : nv + 1
>> ), /* MAKE VECTOR OBJECT */
>> z : z + dz
>> },
>> y : y + dy
>> ^
>> Incorrect syntax: Missing )
>> },
>> x : x + dx
>> },
>>
>>
>
>Well, there are various instances of { and } in the place of ( and ) here.
>Those also need to be replaced.
>
>Maxima recognizes { ... } as a literal set e.g. {a, b, c}.
>A compound expression, comprising multiple expressions and
>evaluated one by one, is (a, b, c) or block(a, b, c).
>The body of a for-loop is an expression (be it simple or compound)
>and although a literal set { ... } is an expression and therefore
>acceptable as a loop body, writing for <whatever> { ... } is probably
>not going to have the effect you intended.
>
>Aside from all that, my guess is that you could substantially
>simplify your program by first constructing a list of tuples from
>the input, then filtering the list to omit the (0, 0, 0) ones.
>
>HTH
>Robert
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>