How to imitate a loop statement in math?

100 Views Asked by At

I need to iterate through expression several times and quit iteration process when certain value is reached but use algebraic notation. Summation notation would have worked if it didn't sum the expression and if we could quit the process when $i$ reaches certain value.

The concept is this: $$ i=0\\ \text{START ITERATION PROCESS WITH}\kern{3pt}i:\\ i=i+1\\ \text{IF}\kern{3pt}i\kern{3pt}=5\kern{3pt}\text{, STOP (CONTINUE OTHERWISE)} $$

How do you do something like this in math?


EDIT (additional information): I wouldn't know the value of $i$ in advance and that's what complicates the issue, I would only know the value after expression is finished in each iteration of the process.

2

There are 2 best solutions below

0
On

Most mathematics books typically do this using a lot of natural language. For your case, you might say:


Suppose $i_{n+1}=i_n+1$ and $i_0=0$. Let us iterate over $n$ until $i_n=5$ (...).

0
On

For $i$ iterating over the set $\{0,1,2,3, 4\}$, do a thing ...

Math is not a programming language. You don't have to worry about syntax errors. Just use words and letters and numbers to communicate what you want to communicate.