Ueda attractor


Author: GC

Date: June 27, 2016

Previous Chirikov map

Next Rössler attractor


We consider Duffing equation with a forcing term: \[ \dfrac{d^2 x}{dt^2} + k \dfrac{dx}{dt} + x^3 = B \cos t, \] which can be rewritten as a system: \[ \begin{cases} \dot{x} = y \\ \dot{y} = -ky - x^3 + B \cos t \end{cases}. \] We compute a sequence of stroboscopic images of the solution with $B=7.5$ and $k=0.05$.



Ueda attractor




Source code

#!/usr/bin/env python3

"""
Program to plot a strange attractor
"""


# scientific libraries
from matplotlib import pyplot as plt
import numpy as np
from scipy.integrate import odeint

# parameters
B = 7.5
k = 0.05

# Duffing system
def system(X,t):
    x, y = X    
    dx = y
    dy = -k*y - x*x*x + B*np.cos(t)
    return [dx, dy]

# numerical integration
X0 = [1, 0]
T = 2*np.pi
N = 10000 
h = T/N
time = np.arange(0, N*T, h)
result = odeint(system, X0, time)
x, y = result.T
X = []
Y = []
for i in range(3,N):
    X = X + [x[N*i]]
    Y = Y + [y[N*i]]

# figure
fig, ax = plt.subplots()
ax.scatter(X, Y, s=3)
ax.axis(off)
plt.show()


Previous Chirikov map

Next Rössler attractor