#!/usr/bin/env python3

# Usage: X,Y = henon(alpha, beta, X0, Y0, L)
#     
# X and Y are the output data 
# alpha, beta are the parameters of the Henon map.
# X0 and Y0 are the initial conditions.
# L is the length of iterations. 

import numpy as np
import matplotlib.pyplot as plt

def henon(alpha, beta, X0, Y0, L):

    X = np.zeros(L)       # initialize/zeroize X and Y
    Y = np.zeros(L)
    
    X[0] = X0               # assign the input initial conditions 
    Y[0] = Y0
                            # compute the Henon map
    for i in range(1,L):              
        X[i] = 1 + Y[i-1] - alpha*X[i-1]**2;
        Y[i] = beta * X[i-1];

    return X,Y

plt.figure()
X,Y = henon(1.4,0.3,0,0,100)
plt.scatter(X,Y)
plt.show()

