LoginSignup
0
1

Pythonでロジスティック写像を描画してみた!

Posted at

はじめに

以前、数値解がカオス的な振る舞いをするローレンツ方程式を実装しました。

それに関連して、こちらも単純な関数でありまがらカオス的な性質を持つロジスティック写像も実装したいと思います。ひとまず理論的な背景はおいておき、プログラムで描画することを目指します。

関数

x_{k+1} = \beta x_{k} (1-x_{k})

$\beta$は定数です。改めて見ると本当に簡単な形ですよね。
この方程式で複雑な振る舞いが生じることをはじめに見つけた人はさぞ驚いたのではないでしょうか。

プログラム

import numpy as np
import matplotlib.pyplot as plt

def logistic_eq(x, beta):
    xn = beta*x*(1 - x)

    return xn

def plot(x, y):
    fig = plt.figure()
    ax = fig.add_subplot()
    ax.scatter(x, y, s=0.01, c='black')

    ax.set_xlabel('x')
    ax.set_ylabel('beta')
    ax.set_ylim(3.45, 4.0)
    ax.invert_yaxis()

    plt.show()

n_x     = 1000
n_beta  = 3000

beta = np.linspace(0, 4, n_beta)

x = np.empty((n_beta, n_x))
x[:, 0] = 0.5

for i in range(n_beta-1):
    for j in range(n_x-1):
        x[i, j+1] = logistic_eq(x[i, j], beta[i])

## plot
y = np.empty((n_beta, n_x))
for i in range(n_beta):
    for j in range(n_x):
        y[i, j] = beta[i]

plot(x, y)

logistic.png

よく見る図ですね。

おわりに

ロジスティク写像をPythonで数値的に描画しました。
前回に引き続き図を出力しただけなので、もっと理論的な背景などもまとめられたらと思います。

読んでいただきありがとうございました。

参考

https://manabitimes.jp/math/712
https://qiita.com/shokishimada/items/acdb1e736d8f441d27d1

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1