Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Python-Programs-for-Nonlinear-Dynamics/Lozi.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45 lines (30 sloc)
842 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed May 2 16:17:27 2018 | |
@author: nolte | |
Introduction to Modern Dynamics, 2nd edition (Oxford University Press, 2019) | |
Lozi discrete map | |
""" | |
import numpy as np | |
from scipy import integrate | |
from matplotlib import pyplot as plt | |
#plt.close('all') | |
B = -1 | |
C = 0.5 | |
np.random.seed(2) | |
plt.figure(1) | |
for eloop in range(0,100): | |
xlast = np.random.normal(0,1,1) | |
ylast = np.random.normal(0,1,1) | |
xnew = np.zeros(shape=(500,)) | |
ynew = np.zeros(shape=(500,)) | |
for loop in range(0,500): | |
xnew[loop] = 1 + ylast - C*abs(xlast) | |
ynew[loop] = B*xlast | |
xlast = xnew[loop] | |
ylast = ynew[loop] | |
plt.plot(np.real(xnew),np.real(ynew),'o',ms=1) | |
plt.xlim(xmin=-1.25,xmax=2) | |
plt.ylim(ymin=-2,ymax=1.25) | |
plt.savefig('Lozi') | |