I am having truble understanding why F1 produces an error, since both time and velocity are the same kind of object:
time = Table[i, {i, 1, 10}]
velocity = Table[0, {i, 1, Length[time]}]
F1[t_, v_, h_] :=
Do[v[[i + 1]] = v[[i]] + t[[i]], {i, 1, Length[t] - 1}]
F1[time, velocity, 1]
F2[t_, h_] :=
Do[velocity[[i + 1]] = velocity[[i]] + t[[i]], {i, 1, Length[t] - 1}]
F2[time, 1]
velocity
Out[253]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Out[254]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
During evaluation of In[253]:= Set::setps: {0,0,0,0,0,0,0,0,0,0} in the part assignment is not a symbol. >>
During evaluation of In[253]:= Set::setps: {0,0,0,0,0,0,0,0,0,0} in the part assignment is not a symbol. >>
During evaluation of In[253]:= Set::setps: {0,0,0,0,0,0,0,0,0,0} in the part assignment is not a symbol. >>
During evaluation of In[253]:= General::stop: Further output of Set::setps will be suppressed during this calculation. >>
Out[259]= {0, 1, 3, 6, 10, 15, 21, 28, 36, 45}
and would be ofcourse thankful for any solutions which include keeping the more general F1 over F2.
Thank you!