Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: LS 30B-2 S19
Views: 238
Kernel: SageMath (stable)

Chaos

We have learned Two Stable System Behaviors

  1. Converge to Equilibrium

  2. Stable Limit Cycle

Is there any other type?

Chaos System{Bounded OutputNot Periodic\begin{cases} \text{Bounded Output}\\ \text{Not Periodic} \end{cases}

Romeo Juliet System (Continuous Time Example)

R′=R+0.1J R' = R + 0.1J

J′=−J−T J' = -J-T

T′=0.1−cT+RT T' = 0.1-cT+RT

Let c=14,R(0)=5,J(0)=5,T(0)=1c = 14,R(0)=5, J(0)=5, T(0)=1

_=var('J,R,T') c = 14 jprime = R+0.1*J rprime = -J-T tprime = 0.1-c*T+R*T
time = srange(0,100,0.1) sol = desolve_odeint([jprime,rprime,tprime],dvars = [J,R,T],times = time,ics = [5,5,1])
list_plot(zip(time,sol[:,0]),plotjoined=True,axes_labels=['time','J'])
Image in a Jupyter notebook
list_plot(zip(time,sol[:,1]),plotjoined=True,axes_labels=['time','R'])
Image in a Jupyter notebook
list_plot(zip(time,sol[:,2]),plotjoined=True,axes_labels=['time','T'])
Image in a Jupyter notebook

It do not converge to any equilibrium point, nor stable limit cycle

However, it is still bounded!

list_plot(sol,plotjoined=True)

Initial Values Matters a Lot

R′=R+0.1J R' = R + 0.1J

J′=−J−T J' = -J-T

T′=0.1−cT+RT T' = 0.1-cT+RT

time = srange(0,500,0.1) sol1 = desolve_odeint([jprime,rprime,tprime],dvars = [J,R,T],times = time,ics = [5,5,1]) sol2 = desolve_odeint([jprime,rprime,tprime],dvars = [J,R,T],times = time,ics = [5.1,5.1,1.1])
fig1 = list_plot(zip(time[0:1000],sol1[0:1000,0]),plotjoined=True)+list_plot(zip(time[0:1000],sol2[0:1000,0]),plotjoined=True,color='red') fig2 = list_plot(zip(time[4000:-1],sol1[4000:-1,0]),plotjoined=True)+list_plot(zip(time[4000:-1],sol2[4000:-1,0]),plotjoined=True,color='red') show(fig1) show(fig2)
Image in a Jupyter notebookImage in a Jupyter notebook
list_plot(sol1,plotjoined=True,color='blue')+list_plot(sol2,plotjoined=True,color='red')
time = srange(0,100,0.1) sol = desolve_odeint([jprime,rprime,tprime],dvars = [J,R,T],times = time,ics = [5,8,2]) fig1 = list_plot(sol,plotjoined=True) sol = desolve_odeint([jprime,rprime,tprime],dvars = [J,R,T],times = time,ics = [1,4,3]) fig2 = list_plot(sol,plotjoined=True,color='red') sol = desolve_odeint([jprime,rprime,tprime],dvars = [J,R,T],times = time,ics = [1.3,-1.6,50]) fig3 = list_plot(sol,plotjoined=True,color='green') show(fig1+fig2+fig3)

Review: Jacobian

[dg(X,Y)dh(X,Y)]=[∂g(X,Y)∂X∂g(X,Y)∂Y∂h(X,Y)∂X∂h(X,Y)∂Y][dxdy]\begin{bmatrix}d g(X,Y)\\dh(X,Y)\end{bmatrix} = \begin{bmatrix}\frac{\partial g(X,Y)}{\partial X}&\frac{\partial g(X,Y)}{\partial Y}\\\frac{\partial h(X,Y)}{\partial X}&\frac{\partial h(X,Y)}{\partial Y}\end{bmatrix}\begin{bmatrix}dx\\dy\end{bmatrix}

If you are at equilibrium point (x0,y0)(x_0,y_0)

g(x0,y0)=0,h(x0,y0)=0g(x_0,y_0)=0 ,h(x_0,y_0)=0

For a point nearby (x0,y0)(x_0,y_0), e.g., (x1,y1)(x_1,y_1)

g(x1,y1)=dg(x,y)g(x_1,y_1) = dg(x,y)

h(x1,y1)=dh(x,y)h(x_1,y_1) = dh(x,y)

[g(x1,y1)h(x1,y1)]=[∂g(X,Y)∂X∂g(X,Y)∂Y∂h(X,Y)∂X∂h(X,Y)∂Y]X=x0,Y=y0[(x1−x0)$y1−y0)]\begin{bmatrix}g(x_1,y_1)\\h(x_1,y_1)\end{bmatrix} = \begin{bmatrix}\frac{\partial g(X,Y)}{\partial X}&\frac{\partial g(X,Y)}{\partial Y}\\\frac{\partial h(X,Y)}{\partial X}&\frac{\partial h(X,Y)}{\partial Y}\end{bmatrix}_{X=x_0,Y=y_0}\begin{bmatrix}(x_1-x_0)$y_1-y_0)\end{bmatrix}

Partial Derivative

g(X,Y,Z)=(X2−Y2)(4X+2Z)−YZ3X+Z3g(X,Y,Z)=(X^2-Y^2)(4X+2Z)-\frac{YZ^3}{X+Z^3}

Find: ∂g∂Z\frac{\partial g}{\partial Z}

Two Rules:

Product Rule: d(ab)dx=dadxb+adbdx\frac{d(ab)}{dx} = \frac{da}{dx}b + a\frac{db}{dx}

dgdZ=(X2−Y2)d(4X+2Z)dZ−d(YZ3(X+Z3)−1)dZ\frac{dg}{dZ} = (X^2-Y^2)\frac{d(4X+2Z)}{dZ}-\frac{d(YZ^3(X+Z^3)^{-1})}{dZ}

=2(X2−Y2)−d(YZ3)dZ(X+Z3)−1−YZ3d(X+Z3)−1dZ=2(X^2-Y^2)-\frac{d(YZ^3)}{dZ}(X+Z^3)^{-1}-YZ^3\frac{d(X+Z^3)^{-1}}{dZ}

But you can also do in this way:

dnumdendx\frac{d\frac{num}{den}}{dx}

=d(num)dxden−numd(den)dxden2= \frac{\frac{d(num)}{dx}den - num\frac{d(den)}{dx}}{den^2}

dgdZ=2(X2−Y2)−3YZ2(X+Z3)−YZ33Z2(X+Z3)2\frac{dg}{dZ} = 2(X^2-Y^2)- \frac{3YZ^2(X+Z^3)-YZ^33Z^2}{(X+Z^3)^2}

=2(X2−Y2)−3XYZ2(X+Z3)2=2(X^2-Y^2)-\frac{3XYZ^2}{(X+Z^3)^2}

Optimization

Suppose the number of sparrows is defined by two parameters:

f(x,y)=9x2+6y2−4x3−2y2−3x2y2f(x,y)=9x^2+6y^2-4x^3-2y^2-3x^2y^2

At which point in the state space will the population be stable?

_= var('x,y,z') f = 9*x^2+6*y^2-4*x^3-2*y^2-3*x^2*y^2 fx = diff(f,x) fy = diff(f,y)
plot3d(-1*f+10^8,(x,-100,100),(y,-100,100)) #I flip the z, so maximum is the lowest point
plot_vector_field((fx,fy),(x,-100,100),(y,-100,100))
Image in a Jupyter notebook
plot3d(f,(x,-100,100),(y,-100,100))

Highest point: Local maximum

X′=0,Y′=0X' =0, Y' = 0

Eigen values of Hessian Matrix <0