6.62 assignment in do loop (27.4.00)

6.62.1 Sherwin J. Singer
6.62.2 Herman Jaramillo (28.4.00)

6.62.1 Sherwin J. Singer

I am a newbie at Maple. I have lots of experience with Mma, and now I’m trying to master Maple 6. I’m having trouble with a calculation – strongly suspect its an "evaluation" thing – but so far it is resistant to whatever documentation I turn to. (Also I’m a little fustrated because Maple 6 on my NT computer crashes when attempting to read the Maple file from a MAC...guess I have to import as Maple text).

The actual workboot is complicated but I can reproduce my error with a simple calculation shown below. No doubt there are simpler ways to program this simple example, but in the actual complicated case using a do loop and appending to a list seems best, so I’d appreciate if someone could help me find my error.

* I’m trying to make c, a list of Arrays of Vectors, from within a do loop over the variable i.

* I calculate a Vector R for each value of i, and I want to append the current value of R to a list nmaed c. Evidently I’m appending the symbol R, because every way I do it, all members of c are equal to the latest value of R. I’ve tried eval, evalm(out of desperation...evalm is really for linalg, right?), value,...no success

with(LinearAlgebra): 
 R:=Array(1..6); 
 R[1]:=Vector([1,1,1]); R[2]:=Vector([2,2,2]); 
 c:=[]; 
 for i from 1 by 1 to 4 do 
     for j from 3 by 1 to 6 do 
         R[j]:=R[j-1]+Vector([i,i,i]); 
     end do; 
 c:=[op(c),eval(R)]; 
 end do;
 

p.s. In the windows version is there a way to set a preference for making only the enter key start evaluation, not the return key. The is a way on the MAC version, but I haven’t found it on the windows versin.

6.62.2 Herman Jaramillo (28.4.00)

I am using Maple release 5 and have no problems. I see that the syntax in Maple 6 is different. I am surprise to see Capital letters at the starting of some instructions (like Array or Vector) that is the typical style of Mathematica.

Here is the example you just wrote down:

c := []; 
                               c := [] 
 
for i from 1 by 1 to 4 do 
 for j from 3 by 1 to 6 do 
    R[j]:= R[j-1]+vector([i,i,i]): 
 od: 
c := [op(c),evalm(R[i])]: 
od: 
 
c; 
           [[1, 1, 1], [2, 2, 2], [5, 5, 5], [10, 10, 10]]
 

I believe this is what you should get, shouldn’t it?.