1 | initial version |
The unit circle is better handled as a set of complex numbers, so you can try to play with:
sage: x = exp(I*pi/5)
sage: f = lambda x : x^2
sage: f(x)
e^(2/5*I*pi)
sage: f(f(x))
e^(4/5*I*pi)
You can also stay on the real line by working modulo $1$ (not $2\pi$ which does not change the nature of the dynamical system), and using the fractional part:
sage: f = lambda x : (2*x) - int(2*x)
sage: f(0.2)
0.400000000000000
sage: f(0.8)
0.600000000000000
sage: f(5/4)
1/2
sage: f(pi)
2*pi - 6
You will enjoy a nice phenomenon : every orbit goes very fast to zero, because of the nature of floating-point numbers, which is also a nice way to explain why we should be very careful about numerical simulations in dynamical systems.
sage: x = RDF.random_element() ; x
0.963562235713
sage: for i in range(60):
....: x = f(x)
....: print(x)
2 | No.2 Revision |
The unit circle is better handled as a set of complex numbers, so you can try to play with:
sage: x = exp(I*pi/5)
sage: f = lambda x : x^2
sage: f(x)
e^(2/5*I*pi)
sage: f(f(x))
e^(4/5*I*pi)
You can also stay on the real line by working modulo $1$ (not $2\pi$ which does not change the nature of the dynamical system), and using the fractional part:
sage: f = lambda x : (2*x) - int(2*x)
sage: f(0.2)
0.400000000000000
sage: f(0.8)
0.600000000000000
sage: f(5/4)
1/2
sage: f(pi)
2*pi - 6
You will enjoy a nice phenomenon : every orbit goes very fast to zero, because of the nature of floating-point numbers, which is also a nice way to explain why we should be very careful about numerical simulations in dynamical systems.systems (note that standard floating points numbers have 53 bits of precision).
sage: x = RDF.random_element() ; x
0.963562235713
sage: for i in range(60):
....: x = f(x)
....: print(x)
3 | No.3 Revision |
The unit circle is better handled as a set of complex numbers, numbers (and doubling the angle is equivalent to squaring), so you can try to play with:
sage: x = exp(I*pi/5)
sage: f = lambda x : x^2
sage: f(x)
e^(2/5*I*pi)
sage: f(f(x))
e^(4/5*I*pi)
sage: f(f(f(x)))
e^(8/5*I*pi)
You can also stay on the real line by working modulo $1$ (not $2\pi$ which $2\pi$, this rescaling does not change the nature of the dynamical system), and using use the fractional part:
sage: f = lambda x : (2*x) - int(2*x)
sage: f(0.2)
0.400000000000000
sage: f(0.8)
0.600000000000000
sage: f(5/4)
1/2
sage: f(pi)
2*pi - 6
You will enjoy a nice phenomenon : the orbit of every orbit numerical number goes very fast to zero, because of the nature of floating-point numbers, which is also a nice way to explain why we should be very careful about numerical simulations in dynamical systems (note that standard floating points numbers have 53 bits of precision).precision):
sage: x = RDF.random_element() ; x
0.963562235713
sage: for i in range(60):
....: x = f(x)
....: print(x)