Question: Why on earth isn't this simple loop working?

Driving me crazy:

lowest_gradient := proc(a) local i, b, c, gp, gn;

b := Array(1..5):
gp := Array(1..5):
for i from 1 to 5 do:
print(a);
b := a;
b[i] := a[i] + eps1;
gp[i] := b;
end do:
end proc:


d := lowest_gradient(initial_point);

 

If you try the loop for yourself, you will see that it is changing the value of the local variable a each time the loops runs, yet I have no idea why, since I have not put any code which should change the value of a.

 

Any ideas?

 

Please Wait...