> with(linalg):with(detools):with(plots):#treiberg/m6412eg1.pdf · brusselator equation phase...

19
MATH 6410 - 1 MAPLE PLOTS OF SYSTEM TRAJECTORIES > with(linalg):with(DEtools):with(plots):# Warning, the protected names norm and trace have been redefined and unprotected Warning, the previous binding of the name adjoint has been removed and it now has an assigned value Warning, the name changecoords has been redefined > restart: > with(plots):with(linalg):with(DEtools): Warning, the name changecoords has been redefined Warning, the protected names norm and trace have been redefined and unprotected Warning, the previous binding of the name adjoint has been removed and it now has an assigned value > F:= (xx,yy)-> xx-yy-xx^2+xx*yy;G:=(xx,yy)->-yy-xx^2; F := xx, yy ( ) ® xx - yy - xx 2 + yy xx G := xx, yy ( ) ® -yy - xx 2 > This time, enter a nonlinear system of equations and a list of initial data. > deqtn:={diff(x(t),t)=F(x(t),y(t)), > diff(y(t),t)=G(x(t),y(t))}; deqtn := d dt xt ( ) = xt ( ) - yt ( ) - xt () 2 + yt () xt ( ), d dt yt ( ) = -yt ( ) - xt () 2 ì í î ü ý þ > ICs:=[[x(0)=-1,y(0)=3],[x(0)=0,y(0)=3],[x(0)=.9,y(0)=3],[x(0)=.6,y(0)=3],[ x(0)=.8,y(0)=3], [x(0)=1,y(0)=3],[x(0)=2,y(0)=3],[x(0)=3,y(0)=3],[x(0)=3,y(0)=0],[x(0)=3,y( 0)=-1.5], [x(0)=0.05,y(0)=0], [x(0)=-.05,y(0)=0],[x(0)=0,y(0)=-.05], [x(0)=0,y(0)=.05], [x(0)=1.5,y(0)=-3], [x(0)=1,y(0)=-3], [x(0)=0,y(0)=-3],[x(0)=-1,y(0)=-3],[x(0)=-2,y(0)=-3],[x(0)=-1.1,y(0)=-1], [x(0)=-1,y(0)=-.9], [x(0)=-.9,y(0)=-1],[x(0)=-1,y(0)=-1.1],[x(0)=-1,y(0)=-.95], [x(0)=-1,y(0)=-1.05]]: > > DEplot(deqtn,[x(t),y(t)],t=0..15,ICs,x=-3..3,y=-3..3,arrows=small, > stepsize=.1,color=navy,linecolor=red,title=`Nonlinear System`);

Upload: others

Post on 10-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

MATH 6410 - 1 MAPLE PLOTS OF SYSTEM TRAJECTORIES

> with(linalg):with(DEtools):with(plots):# Warning, the protected names norm and trace have been redefined and unprotected

Warning, the previous binding of the name adjoint has been removed and it now has an assigned value

Warning, the name changecoords has been redefined

> restart:

> with(plots):with(linalg):with(DEtools):Warning, the name changecoords has been redefined

Warning, the protected names norm and trace have been redefined and unprotected

Warning, the previous binding of the name adjoint has been removed and it now has an assigned value

> F:= (xx,yy)-> xx-yy-xx^2+xx*yy;G:=(xx,yy)->-yy-xx^2;

F := xx, yy( ) ® xx - yy - xx 2 + yy xx

G := xx, yy( ) ® -yy - xx 2

>

This time, enter a nonlinear system of equations and a list of initial data.

> deqtn:={diff(x(t),t)=F(x(t),y(t)),

> diff(y(t),t)=G(x(t),y(t))};

deqtn := d dt

x t( ) = x t( ) - y t( ) - x t( )2 + y t( ) x t( ), d dt

y t( ) = -y t( ) - x t( )2ìíî

üýþ

> ICs:=[[x(0)=-1,y(0)=3],[x(0)=0,y(0)=3],[x(0)=.9,y(0)=3],[x(0)=.6,y(0)=3],[x(0)=.8,y(0)=3], [x(0)=1,y(0)=3],[x(0)=2,y(0)=3],[x(0)=3,y(0)=3],[x(0)=3,y(0)=0],[x(0)=3,y(0)=-1.5], [x(0)=0.05,y(0)=0], [x(0)=-.05,y(0)=0],[x(0)=0,y(0)=-.05], [x(0)=0,y(0)=.05], [x(0)=1.5,y(0)=-3], [x(0)=1,y(0)=-3], [x(0)=0,y(0)=-3],[x(0)=-1,y(0)=-3],[x(0)=-2,y(0)=-3],[x(0)=-1.1,y(0)=-1], [x(0)=-1,y(0)=-.9], [x(0)=-.9,y(0)=-1],[x(0)=-1,y(0)=-1.1],[x(0)=-1,y(0)=-.95], [x(0)=-1,y(0)=-1.05]]:

>

> DEplot(deqtn,[x(t),y(t)],t=0..15,ICs,x=-3..3,y=-3..3,arrows=small,

> stepsize=.1,color=navy,linecolor=red,title=`Nonlinear System`);

Page 2: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

y

x

3

3

2

1

20

-1

1

-2

-3

0-1-2-3

Nonlinear System

>

To find the critical points, enter the right side. then find the vanishing points of the vector field.

> solve({F(u,v)=0,G(u,v)=0},{u,v});

Page 3: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

u = 0, v = 0{ }, v = -1, u = 1{ }, v = -1, u = -1{ }

> x0:=-1;y0:=-1;x0 := -1

y0 := -1

Plot of solutions of the nonlinear equation near the critical point (-1,-1)

> IC2:=[seq([x(0)=-1.+0.01*k,y(0)=-1.+0.01*k],k=0..10)]:

> DEplot(deqtn,[x(t),y(t)],t=0..15,IC2,x=-1.1..-0.9,y=-1.1..-0.9,arrows=small,

> stepsize=.1,color=navy,linecolor=red,scaling=constrained,title=`Nonlinear System near (-1,-1)`);

Page 4: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

y

x

-0.9-0.9

-0.95

-1

-0.95

-1.05

-1.1

-1-1.05-1.1

Nonlinear System near (-1,-1)

Look near the equilibrium point (-1,-1). First, near that point, by the 2-dimensional Taylor's Theorem, the system is approximated by the linear system whose matrix is [F(-1+u,-1+v),G(-1+u,-1+v)]=[0 +diff(F(x,y),x)*u +diff(F(x,y),y)*v, 0+ diff(G(x,y),x)*u+diff(G(x,y),y)*v].

> A:=subs({x=x0,y=y0},matrix([ [diff(F(x,y),x),diff(F(x,y),y)],[diff(G(x,y),x),diff(G(x,y),y)]]));

Page 5: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

A := 2 -2

2 -1

éêêë

ùúúû

> eigenvects(A);

12

+ 12

I 7 , 1, 34

+ 14

I 7 , 1éêë

ùúû

ìíî

üýþ

éêêë

ùúúû

, 12

- 12

I 7 , 1, 34

- 14

I 7 , 1éêë

ùúû

ìíî

üýþ

éêêë

ùúúû

Define a linear system using the matrix.

> ODE1:={diff(x(t),t)=(A[1,1]*x(t)+A[1,2]*y(t)),diff(y(t),t)=A[2,1]*x(t)

> +A[2,2]*y(t)};

ODE1 := d dt

y t( ) = 2 x t( ) - y t( ), d dt

x t( ) = 2 x t( ) - 2 y t( )ìíî

üýþ

> ICL2:=[seq([x(0)=0.1*k,y(0)=0.1*k],k=0..10)]:

> phaseportrait(ODE1,[x(t),y(t)],0.0..11.0,ICL2, x=-1.1..1.1,

> y=-1.1..1.1, scaling=constrained,stepsize=.05,title=`Linearization at

> (-1,-1)`,linecolor=black);

Page 6: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

-1

0-0.5-1

y

x

1

1

0.5

00.5

-0.5

Linearization at(-1,-1)

The real parts are positive, so the local picture is that of a spiral source.

Plot of solutions of the nonlinear equation near the critical point (-1,-1)

> x0:=1;y0:=-1;

Page 7: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

x0 := 1

y0 := -1

> IC2:=[seq([x(0)=1.0+0.1*cos(k*Pi/6),y(0)=-1.0+0.1*sin(k*Pi/6)],k=0..11)]:

> DEplot(deqtn,[x(t),y(t)],t=0..3,IC2,x=0.9..1.1,y=-1.1..-0.9,arrows=small,

> stepsize=.03,color=navy,linecolor=red,scaling=constrained,title=`Nonli

> near System near (1,-1)`);

Page 8: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

x

y

1.1-0.9

-0.95

1.05

-1

-1.05

1

-1.1

0.950.9

Nonlinear System near (1,-1)

Page 9: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

Find the linearization near (1,-1) as before and plot the solutions of the linearized equations.

> A:=subs({x=x0,y=y0},matrix([ [diff(F(x,y),x),diff(F(x,y),y)],

> [diff(G(x,y),x),diff(G(x,y),y)]]));

A := -2 0

-2 -1

éêêë

ùúúû

> eigenvects(A);-1, 1, 0, 1[ ]{ }[ ], -2, 1, 1, 2[ ]{ }[ ]

> ODE2:={diff(x(t),t)=(A[1,1]*x(t)+A[1,2]*y(t)),diff(y(t),t)=A[2,1]*x(t)+A[2,2]*y(t)};

ODE2 := d dt

y t( ) = -2 x t( ) - y t( ), d dt

x t( ) = -2 x t( )ìíî

üýþ

> ICl2:=[seq([x(0)=cos(k*Pi/6),y(0)=sin(k*Pi/6)],k=0..11)]:

> phaseportrait(ODE2,[x(t),y(t)],0.0..4.0,ICl2, x=-1.1..1.1,

> y=-1.1..1.1, scaling=constrained,stepsize=.05,title=`Linearization at

> (1,-1)`,linecolor=black);

Page 10: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

-1

0-0.5-1

y

x

1

1

0.5

00.5

-0.5

Linearization at(1,-1)

3. STABLE LIMIT CYCLES

Rayleigh's Clarinet Equation

Finally, we illustrate by way of examples, that a planar system may have a stable limit cycle, a closed periodic trajectory that attracts nearby trajectories. Consider the equation proposed by Lord Rayleigh for the vibration of a clarinet reed. mx'' = -kx + ax' -b(x')^3 which is stiffer than linear drag but soggier for small displacements. As in the text, we convert to a first order system with a=b=m=k=1.

Page 11: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

> ODE3:={diff(x(t),t)=y(t),diff(y(t),t)=-x(t)+y(t)-y(t)^3};

ODE3 := d dt

x t( ) = y t( ), d dt

y t( ) = -x t( ) + y t( ) - y t( )3ìíî

üýþ

> IC3:=[[x(0)=-2,y(0)=3],[x(0)=0,y(0)=3],[x(0)=2,y(0)=3],

> [x(0)=-2,y(0)=-3],[x(0)=0,y(0)=-3],[x(0)=2,y(0)=-3],

> [x(0)=-.2,y(0)=.3],[x(0)=0,y(0)=.3],[x(0)=.2,y(0)=.3],

> [x(0)=-.2,y(0)=-.3],[x(0)=0,y(0)=-.3],[x(0)=.2,y(0)=-.3]]:

> DEplot(ODE3,[x(t),y(t)],t=0..10,IC3,x=-3..3,y=-3..3,arrows=small,

> stepsize=.1,color=black,linecolor=t,title=`Clarinet Equation Phase

> Portrait`);

Page 12: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

y

x

3

3

2

1

20

-1

1

-2

-3

0-1-2-3

Clarinet Equation PhasePortrait

The Brusselator

A model for a hypothetical chemical interaction of two species, which was proposed by researchers from Brussels, is given by the following equation

Page 13: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

> a:= 1.0; b:= 3.0;a := 1.0

b := 3.0

> ODE4:={diff(x(t),t)=a-(b+1)*x(t)+x(t)^2*y(t),diff(y(t),t)=b*x(t)-x(t)^

> 2*y(t)};

ODE4 := d dt

y t( ) = 3.0 x t( ) - x t( )2 y t( ), d dt

x t( ) = 1.0 - 4.0 x t( ) + x t( )2 y t( )ìíî

üýþ

> IC4:=[[x(0)=0.2,y(0)=0.2],[x(0)=2.2,y(0)=0.2],[x(0)=4.2,y(0)=0.2],[x(0

> )=0.2,y(0)=3.2],[x(0)=0.2,y(0)=5.2],[x(0)=2.2,y(0)=6.2],[x(0)=2,y(0)=3

> ],[x(0)=1,y(0)=4],[x(0)=1,y(0)=2.6]]:

> DEplot(ODE4,[x(t),y(t)],t=0..7,IC4,x=0..4,y=0..6,arrows=small,

> stepsize=.0475,color=black,linecolor=[red,coral,yellow,green,cyan,blue

> ,navy,maroon,magenta],title=`Brusselator Equation Phase Portrait`);

Page 14: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

x43210

y

6

5

4

3

2

1

0

Brusselator Equation Phase Portrait

Page 15: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

Predator Prey models

The simplest model is the Lotka-Volterra for the (nondimensionalized) prey x(t) and the predator y(t)

> a:= 0.7;a := 0.7

> ODE5:={diff(x(t),t)=x(t)*(1-y(t)),diff(y(t),t)=a*y(t)*(x(t)-1)};

ODE5 := d dt

y t( ) = 0.7 y t( ) x t( ) - 1( ), d dt

x t( ) = x t( ) 1 - y t( )( )ìíî

üýþ

> IC4:=[[x(0)=0.2,y(0)=0.2],[x(0)=2.2,y(0)=0.2],[x(0)=4.2,y(0)=0.2],[x(0

> )=0.2,y(0)=3.2],[x(0)=0.2,y(0)=5.2],[x(0)=2.2,y(0)=6.2],[x(0)=2,y(0)=3

> ],[x(0)=1,y(0)=4],[x(0)=1,y(0)=2.6]]:

> DEplot(ODE5,[x(t),y(t)],t=0..15,IC4,x=0..6,y=0..6,arrows=small,

> stepsize=.0475,color=black,linecolor=[red,coral,yellow,green,cyan,blue

> ,navy,maroon,magenta],title=`Brusselator Equation Phase Portrait`);

Page 16: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

y

x

6

6

5

4

5

3

2

4

1

03210

Brusselator Equation Phase Portrait

Page 17: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

More realistically, the prey growth is not unbounded but logistic, predator carrying capacity is proportional to prey density

> a:= 0.75; b:= 0.2;c:=0.05;a := 0.75

b := 0.2

c := 0.05

> b-(a-sqrt((1.0-a-c)^2+4.0*c))*(1.0+a+c-sqrt((1.0-a-c)^2+4.0*c));-0.1407602310

> ODE6:={diff(x(t),t)=x(t)*(1-x(t)-a*y(t)/(c+x(t))),diff(y(t),t)=b*y(t)*(1-y(t)/x(t))};

ODE6 := d dt

x t( ) = x t( ) 1 - x t( ) - 0.75 y t( )0.05 + x t( )

æçè

ö÷ø

, d dt

y t( ) = 0.2 y t( ) 1 - y t( )x t( )

æçè

ö÷ø

ìíî

üýþ

> IC5:=[[x(0)=0.2,y(0)=0.2],[x(0)=0.4,y(0)=0.2],[x(0)=0.5,y(0)=0.2],[x(0

> )=0.6,y(0)=0.2],[x(0)=0.2,y(0)=0.4],[x(0)=0.2,y(0)=0.5],[x(0)=0.4,y(0)=1.0

> ],[x(0)=1,y(0)=0.5],[x(0)=0.4,y(0)=0.4],[x(0)=0.39,y(0)=0.39]]:

> DEplot(ODE6,[x(t),y(t)],t=0..60.0,IC5,x=0..0.9,y=0..0.5,arrows=small,

> stepsize=.0475,color=black,linecolor=[red,coral,yellow,green,cyan,blue

> ,navy,maroon,magenta,black],title=`Brusselator Equation Phase Portrait`);

Page 18: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)

0.40.20

y

0.5

0.4

0.3

x

0.2

0.1

0.80

0.6

Brusselator Equation Phase Portrait

Page 19: > with(linalg):with(DEtools):with(plots):#treiberg/M6412eg1.pdf · Brusselator Equation Phase Portrait Predator Prey models The simplest model is the Lotka-Volterra for the (nondimensionalized)