File:PoincareMap Lorenz Runge Lcycle.svg

Summary

Description
English: Periodic orbit and Poincaré map. the periodic orbit is stable limit cycle which is generated by Lorenz equation
where σ = 10, r = 220, b = 8/3.
Date
Source Own work
Author Yapparina
Python source
InfoField
import numpy as np
import matplotlib.pyplot as plt

n = 100000
h = 0.0001
T = h*n
t = np.arange(0,T,h)

PX =[]
PY =[]
PZ =[]

sigma = 10
b = 8/3
r = 220

def dxdt(x,y,z): 
    return -sigma * x + sigma * y
def dydt(x,y,z): 
    return r * x - y -x * z
def dzdt(x,y,z): 
    return -b * z + x * y

Xst = (b*(r-1))**0.5
Yst = (b*(r-1))**0.5
Zst = r - 1

x = np.empty(n)
y = np.empty(n)
z = np.empty(n)
x[0] = 22
y[0] = 70
z[0] = 180

for i in range(n-1):
    k_1 = dxdt(x[i] , y[i] , z[i])
    j_1 = dydt(x[i] , y[i] , z[i])
    m_1 = dzdt(x[i] , y[i] , z[i])
       
    k_2 = dxdt(x[i] + k_1 * h / 2 , y[i] + j_1 * h / 2, z[i] + m_1 * h / 2)
    j_2 = dydt(x[i] + k_1 * h / 2 , y[i] + j_1 * h / 2, z[i] + m_1 * h / 2)
    m_2 = dzdt(x[i] + k_1 * h / 2 , y[i] + j_1 * h / 2, z[i] + m_1 * h / 2)

    k_3 = dxdt(x[i] + k_2 *h / 2 , y[i] + j_2 * h / 2 , z[i] + m_2 * h / 2)
    j_3 = dydt(x[i] + k_2 *h / 2 , y[i] + j_2 * h / 2 , z[i] + m_2 * h / 2)
    m_3 = dzdt(x[i] + k_2 *h / 2 , y[i] + j_2 * h / 2 , z[i] + m_2 * h / 2)

    k_4 = dxdt(x[i] + k_3 *h , y[i] + j_3 * h , z[i] + m_3 * h)
    j_4 = dydt(x[i] + k_3 *h , y[i] + j_3 * h , z[i] + m_3 * h)
    m_4 = dzdt(x[i] + k_3 *h , y[i] + j_3 * h , z[i] + m_3 * h)

    x[i+1] = x[i] + h/6 * (k_1 + 2*k_2 + 2*k_3 + k_4 )
    y[i+1] = y[i] + h/6 * (j_1 + 2*j_2 + 2*j_3 + j_4 )
    z[i+1] = z[i] + h/6 * (m_1 + 2*m_2 + 2*m_3 + m_4 )    

    if (x[i+1] - Xst) > 0 and (x[i] - Xst) < 0:
        PX.append(Xst)
        PY.append(y[i])
        PZ.append(z[i])

astime = int(n/2)
asx= x[astime:]
asy= y[astime:]
asz= z[astime:]

fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.plot(asx, asy, asz, color='lime', linewidth=0.5)
ax.scatter(PX, PY, PZ, marker=".", color='black')
plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#PoincareMap%20Lorenz%20Runge%20Lcycle.svg
Category:Self-published work Category:Poincare map Category:Lorenz attractors Category:Images with Python source code
Category:CC-Zero Category:Images with Python source code Category:Lorenz attractors Category:Poincare map Category:Self-published work