I am trying to understand the workings of for-do loop and trying to access the different items in the lists below:
(%i2) thetas : [45,-45,-45,45]$
z : [-0.5,-0.25,0.0,0.25,0.5]$
(%i3) for c1:1 thru length(thetas) do
(
htop : z[c1+1],
hbottom : z[c1],
theta : thetas[c1]*%pi/180,
disp(htop),
disp(hbottom),
disp(theta)
);
which produces:
The thetas are being displayed as desired. On the other hand, during the first pass, I was expecting -0.25 assigned to htop instead of z_2 and -0.5 assigned to hbottom instead of the list with subscript 1. How can I cycle through the list z and assign (numerical) values to the hbottom and htop during each pass of the loop?