Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'when loop bounds are variables...' topicStudent Support Forum > General > Archives > "when loop bounds are variables..."

Help | Reply To Topic
Author Comment/Response
Edward Zhang
06/26/07 2:51pm

In a do loop (or any other loop construct) like this

In[1]:= y = y0; Do[y = 2 y + 1, {i, 1, 4, 1}]; y
Out[1]= 1 + 2 (1 + 2 (1 + 2 (1 + 2 y0)))

this is ok when the loop bound is real number (1,4 here), how about when the bound is some variable symbol?

when the input is like
y = y0; Do[y = y + 1, {i, a, b, 1}]; y
I want to get the answer in the form of
y0 + b - a
is this possible? how to do this?

Thank you very much in advance!

URL: ,
Help | Reply To Topic