瀏覽代碼
Ajout des sources du chaos
master
Dimitri Merejkowsky
4 年之前
沒有發現已知的金鑰在資料庫的簽署中
GPG 金鑰 ID: 6BF3C7EA7C2D64EC
共有
1 個檔案被更改,包括
28 行新增 和
0 行删除
-
saison-2/sources/chaos/suite.py
|
|
@@ -0,0 +1,28 @@ |
|
|
|
import numpy |
|
|
|
from matplotlib import pyplot |
|
|
|
import sys |
|
|
|
|
|
|
|
ITERATIONS = 1000 |
|
|
|
|
|
|
|
|
|
|
|
def suite(initial, k): |
|
|
|
ts = numpy.linspace(0, 1, ITERATIONS) |
|
|
|
x = initial |
|
|
|
vs = [] |
|
|
|
for i in ts: |
|
|
|
vs.append(x) |
|
|
|
x = x * k * (1 - x) |
|
|
|
return (ts, vs) |
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
k = float(sys.argv[1]) |
|
|
|
# 1.2 ou 2.8 ou 3.5 ou 3.86 |
|
|
|
ts, vs = suite(0.5, k) |
|
|
|
ts, vs2 = suite(0.4, k) |
|
|
|
pyplot.plot(ts, vs) |
|
|
|
pyplot.plot(ts, vs2) |
|
|
|
pyplot.show() |
|
|
|
|
|
|
|
|
|
|
|
main() |