Re: Mathematical models for loop calculations



On Sep 26, 10:54 am, Randy Poe <poespam-t...@xxxxxxxxx> wrote:
On Sep 26, 9:08 am, Tim Frink <plfr...@xxxxxxxx> wrote:

Hi,

I'm looking for an approach to represent calculations within
a loop (of a computer program) by mathematical models. To make
things clear, here is a simple example for a loop that iterates
10 times:

i = 0,
b = 2,
c = 2,
d = 2,
e = 2;

Is everybody just joking with OP? This is trivial.
Maybe they assume it's homework?

if your interpretation of the post is correct
then the responses have been hilarious

mathematical representations of computer variables
and particularly that in imperative language they are time-dependent
is not a trivial question

the simplest representation is in a modal logic
where
for instance
"[]_t x" would represent "the value of x at time t"

then the evolution of the program's execution
must be encoded in formulae for []_t
over all of the various states of the program

extracting recursion formulae for []_t
can give particular forms for particular problems
and if we just focus on the particulars of the posted problem
( corrected appropriately for initialisation of a )
then your approach can easily be coded in such a framework

i assumed (along with duncan apparently)
that the question was about building such models generically
but obviously it could have just been CSci 101 homework...

i think either a quickly thrown together example for generalisation
or a sloppily transcribed homework problem
both are possible explanations for the missing "a"

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

.



Relevant Pages