# Re: Mathematical models for loop calculations

*From*: Tim Frink <plfriko@xxxxxxxx>*Date*: Wed, 26 Sep 2007 16:47:04 +0200

On Wed, 26 Sep 2007 13:46:20 +0000, Richard Heathfield wrote:

i = 0,

b = 2,

c = 2,

d = 2,

e = 2;

while( i < 10 ) {

a = a + 1;

b = b + b;

c = c * c;

d = d + e;

e = e + 1;

i++;

}

Overall:

a += I;

b = pow(2, I);

c = pow(2, pow(2, I));

d = I * (I + 1) /2 + 1;

e += I;

I just see that these cases work since most of the variables

were assigned the value '2'. If you change them to '3', some

formulas like the one for 'b' will not work any more.

Are there also any general formulas that depend on the current

value of the identifiers before entering the loop?

.

**Follow-Ups**:**Re: Mathematical models for loop calculations***From:*Richard Heathfield

**References**:**Mathematical models for loop calculations***From:*Tim Frink

**Re: Mathematical models for loop calculations***From:*Richard Heathfield

- Prev by Date:
**Re: Mathematical models for loop calculations** - Next by Date:
**shared objects with C++** - Previous by thread:
**Re: Mathematical models for loop calculations** - Next by thread:
**Re: Mathematical models for loop calculations** - Index(es):