Re: Mathematical models for loop calculations
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Wed, 26 Sep 2007 15:30:59 +0000
Tim Frink said:
On Wed, 26 Sep 2007 13:46:20 +0000, Richard Heathfield wrote:
Thank you. This showed me that this should work in general.
b = pow(2, I);
Seems to be a small mistake,
should be "b = power(2,I);
I fail to see the mistake. You've just typed what I typed, except that
you've written power rather than pow. The pow function is in the standard
C library, which is why I chose it. If your language provides power
instead of pow, that's fine, but it doesn't make my choice a mistake.
Could you think of any cases where this approach by expressing
the calculations by formulas will fail?
Yup. Non-linear dynamical systems spring to mind. For example, consider the
logistic mapping
k = 3.99;
x = 0.1;
for(i = 0; i < n; i++)
{
x = k * x * (1.0 - x);
}
The behaviour is chaotic (in the mathematical sense of the word). Good luck
finding an equation that exactly mimics n iterations of the loop, for any
reasonably large n. (If you manage it, publish!)
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: Mathematical models for loop calculations
- From: Tim Frink
- Re: Mathematical models for loop calculations
- References:
- Mathematical models for loop calculations
- From: Tim Frink
- Re: Mathematical models for loop calculations
- From: Richard Heathfield
- Re: Mathematical models for loop calculations
- From: Tim Frink
- Mathematical models for loop calculations
- Prev by Date: shared objects with C++
- Next by Date: Re: Mathematical models for loop calculations
- Previous by thread: Re: Mathematical models for loop calculations
- Next by thread: Re: Mathematical models for loop calculations
- Index(es):
Relevant Pages
|