解常微分方程
Rossler混沌系统是一个非线性系统,可以由下面确定的三维非线性方程组来描述:
\[\begin{matrix} \dot x_{1} & = & -wx_{2}-x_{3} \\ \dot x_{2} & = & wx_{1}+ax_{2} \\ \dot x_{3} & = & x_{3}\left(x_{1}-c \right) +b \\ \end{matrix} \]
其中\(w\),\(a\),\(b\),\(c\)是系统的三个控制参数。\(x_{1}\),\(x_{2}\),\(x_{3}\)是系统的状态变量。
当参数取值\(w=1\),\(a=0.2\),\(b=0.2\),\(c=5.7\)时,Rossler系统会产生混沌现象。

local print = require('package.print').print
local inja = require('package.inja')
local plt = require 'package.plot'
local mol = libminoptlab
local w,a,b,c = 1,0.2,0.2,5.7
function system(x, t)
return {-w*x[2]-x[3],w*x[1]+a*x[2],(x[1]-c)*x[3]+b}
end
local x0 = {1,0,0}
local t0 , t1 = 0, 100
local step = 0.01
local is_stiff = false
local odesolver = mol.ode.new(system , x0 , t0 , t1 , step , is_stiff );
local t = mol.linspace(t0 , t1 , 3000)
local x = mol.matrix.new(#t, #x0)
for i = 1, x.nrow do
for j = 1,x.ncol do
x:set(i,j,odesolver:get(j, t[i]))
x:set(i,j,odesolver:get(j, t[i]))
end
end
local img = plt.plot3d('plot', {{x:col(1):tovector(), x:col(2):tovector(), x:col(3):tovector()}}, {'Rossler 混沌系统'})
local fw = plt.framework3d(111, 'Rossler 混沌系统', {'x', 'y', 'z'})
plt.show({{fw , {img}}})