less_retarded_wiki/chaos.md
Miloslav Ciz ff1da66b9c Update
2022-07-05 15:26:04 +02:00

20 lines
3.2 KiB
Markdown

# Chaos
In [mathematics](math.md) chaos is a phenomenon that makes it extremely difficult to predict, even approximately, the result of some process even if we completely know how the process works and what state it starts in. In more technical terms chaos is a property of a [nonlinear](nonlinear.md) [deterministic](determinism.md) [system](system.md) in which even a very small change in input creates a great change in the output, i.e. the system is very sensitive to [initial conditions](initial_condition.md). Chaos is a topic studied by the field called **chaos theory** and is important in all [science](science.md). In [computer science](compsci.md) it is important for example for the generation of [pseudorandom](pseudorandom.md) numbers or in [cryptography](cryptography.md). Every programmer should be familiar with the existence of chaotic behavior because in mathematics (programming) it emerges very often, it may pose a problem but, of course, it may be taken advantage of as well.
Perhaps the most important point is that a chaotic system is difficult to predict NOT because of [randomness](randomness.md), lack of information about it or even its incomprehensible complexity (many chaotic systems are defined extremely simply), but because of its inherent structure that greatly amplifies any slight nudge to the system and gives any such nudge a great significance. This may be caused by things such as [feedback loops](feedback_loop.md) and [domino effects](domino_effect.md). Generally we describe this behavior as so called **[butterfly effect](butterfly_effect.md)** -- we liken this to the fact that a butterfly flapping its wings somewhere in a forest can trigger a sequence of events that may lead to causing a tornado in a distant city a few days later.
Examples of chaotic systems are the double pendulum, weather (which is why it is so difficult to predict it), dice roll, [rule 30](rule_30.md) cellular automaton, [logistic map](logistic_map.md), gravitational interaction of [N bodies](n_body.md) or [Lorenz differential equations](lorenz_system.md). [Langton's ant](langtons_ant.md) sometimes behaves chaotically. Another example may be e.g. a billiard table with multiple balls: if we hit one of the balls with enough strength, it'll shoot and bounce off of walls and other balls, setting them into motion and so on until all balls come to stop in a specific position. If we hit the ball with exactly the same strength but from an angle differing just by 1 degree, the final position would probably end up being completely different. Despite the system being deterministic (governed by exact and predictable laws of motion, neglecting things like quantum physics) a slight difference in input causes a great different in output.
A simple example of a chaotic equation is also the function *sin(1/x)* for *x* near 0 where it oscillates so quickly that just a tiny shift along the *x* axis drastically changes the result. See how unpredictable results a variant of the function can give:
| *x* | *1000 * sin(10^9 / x)* |
|-------|------------------------|
| 4.001 | 455,... |
| 4.002 | 818,... |
| 4.003 | -511,... |
| 4.004 | -974,... |
| 4.005 | -335,... |