# computational science by heider jeffer

Embed Size (px)

TRANSCRIPT

The dancer's equilibrium is unstable. If she didn't constantly make tiny adjustments, she would tip over.

Topics in Informatics (Fall 2009)

instructor: Mehdi Jazayeriassistant: Sasa Nesic

class date:speaker:

topic: Computational Science

Equilibrium Analysis

Hayder ALMusawiHeider Jeffer

Hayder ALMusawi Computational Science Mechanism A body may be in one of five states of equilibrium Stable , Unstable , Neutral , Metastable and Metastable with multiple stable states(globally stable). Stability the ability to maintain normal characteristics. Stable Equilibrium a body is in stable equilibrium if it returns to its equilibrium position after it has been displaced slightly. Unstable Equilibrium a body is in unstable equilibrium if it does not return to its equilibrium position and does not remain in the displaced position after it has been displaced slightly. Neutral Equilibrium a body is in neutral equilibrium if it stays in the displaced position after if has been displaced slightly. Metastable Equilibrium the body returns towards equilibrium as long as disturbances are not too large. The equilibrium is not globally stable because once the ball has crossed the unstable equilibrium (the peak), it is unlikely to return to the stable point. Metastable Equilibrium with multiple stable states the body returns towards one or the other equilibrium depending on which side of the unstable equilibrium it is. The system is globally stable.

Stableandunstableequilibria.

Equilibrium Analysis By Heider Jeffer________________________________________________________

Hayder ALMusawi Computational Science

A:Stable Equilibrium B:Unstable Equilibrium C:Neutral Equilibrium D:Metastable Equilibrium E:Metastable Equilibrium with multiple stable states

Equilibrium Analysis By Heider Jeffer_____________________________________________________________

Hayder ALMusawi Computational Science

AttractorsandTheirTypesWhenthedynamicsofapopulationmodelistracedoveralargenumberofgenerations,thenthemodelexhibitsanasymptoticbehaviorwhichisalmostindependentfrominitialconditions(e.g.,initialpopulationdensity).Asymptotictrajectoryiscalled"attractor"becausemodeltrajectoriesconvergetothisasymptotictrajectory.There may be several attractors in a model. In this case each attractor has a domain of attraction. Model trajectory converges to that attractor in which domain initial conditions were located.

In this example, there are two attractors: a limit cycle (at the left) and a stable equilibrium (at the right). Domains of attraction are colored blue, they never overlap. For different starting places (initial conditions), trajectories converge to different attractors. Types of attractors:

1. Stable equilibrium (=steady state) 2. Limit cycle 3. Chaos

Examples:

This is a chaotic attractor (Lorenz attractor)

Equilibrium Analysis By Heider Jeffer___________________________________________________________

Hayder ALMusawi Computational Science Example

1. A chemical plant requires as input a chemical substance that goes through two processing stages in acascade of reactors. Each reactor is modelled as a reservoir: the variation of mass over time is equalto the net inflow. The mass contained in each reactor is labelled as xi. The outflow from each reactoris proportional to the mass of substance: axi.The outflow from the last reactor is perturbed by a disturbance d, which is coming from another planthat is only occasionally active: z(t) = y(t) + d(t).

x1

x2

a*x1

u

y=a*x2d

Chemical Plant

z=y+d

(a) Write the set of di!erential equations of the cascade of reactors;(b) Formulate the state-space representation of the cascade of reactors;(c) Find the equilibrium of the system, if any;(d) Study the stability of the system;

(Total: 30 points)

2

Equilibrium Analysis By Heider Jeffer___________________________________________________________

Hayder ALMusawi Computational Science Solution

Solution:

(a) Equations

The system has two state variables!x1

x2

", and its output is z:

#$

%

x1 = !ax1 + ux2 = !ax2 + ax1

z = ax2 + d

(b) The state-space representation of the system is the following:!x1

x2

"=

!!a 0a !a

" !x1

x2

"+

!10

"u

z =&0 a

' !x1

x2

"+ d

(c) For the equilibrium:(x1 = 0x2 = 0 "

(!ax1 + u = 0!ax2 + ax1 = 0 "

(x1 = u

ax2 = x1

"(

x1 = ua

x2 = ua

The equilibrium point is (ua , u

a )(d) For the system stability, we calculate its eigenvalues from the characteristic equation:

|A! !I| = 0"))))!a! ! 0

a !a! !

)))) = 0" (!a! !)2 = 0" ! = !a

The system has a double eigenvalue that is a negative real. Therefore it is stable and not oscil-lating.

3

Equilibrium Analysis By Heider Jeffer__________________________________________________________

Hayder ALMusawi Computational Science Example

Solution

2. Given the system:x1 = x1x2 + x2

2

x2 = x1x2 ! 5x2 + u

Answer the following questions:

(a) Is the system linear?(b) How many equilibria can this model have?(c) Which are these equilibria if u is constant and equal to 6?

(Total: 30 points)Solution:

(a) The system is not linear as it contains a second-order term (x22).

(b) An equilibrium state is a situation where the system doesn’t change its behaviour, so the deriva-tives are set to 0:

x1x2 + x22 = 0

x1x2 ! 5x2 + u = 0

from the first equation we obtain

x1x2 + x22 = 0" x2(x1 + x2) = 0

This equation has two solutions: The first is

x1 = !x2

And the second is:x2 = 0

For the first solution:We substitute x1 = !x2 into the second equation:

!x22 ! 5x2 + u = 0" x2

2 + 5x2 ! u = 0

The polynomial has two solutions:

x2 =!5±

#25 + 4u

2and, since x1 = !x2, we obtain two solutions that produce two equilibria state:

Equil. 1 : (x1, x2)a =!

5!"

25+4u2 , !5+

"25+4u2

"

Equil. 2 : (x1, x2)b =!

5+"

25+4u2 , !5!

"25+4u2

"

For the second solution:When x2 = 0 the second equation reduces to u = 0. If this is the case (i.e. u = 0) there is anequilibrium for any values of x1, that satisfy x2 = 0. This leads to an infinite number of solutions(the line x2 = 2). In case u $= 0, we end up to an impossible situation, i.e., there are no equilibriafrom this solution.In overall: If u $= 0 then we have two equilibria points ((x1, x2)a and (x1, x2)b indicated above).If u = 0 we have infinite equilibria points: The two (x1, x2)a and (x1, x2)b indicated above, andthe line x2 = 0

(c) In the specific case u = 6, system has two equilibria points:

Equil. 1 : (x1, x2)a =!

5!"

25+4#62 , !5+

"25+4#62

"= (!1, 1)

Equil. 2 : (x1, x2)b =!

5+"

25+4#62 , !5!

"25+4#62

"= (6,!6)

4

2. Given the system:x1 = x1x2 + x2

2

x2 = x1x2 ! 5x2 + u

Answer the following questions:

(a) Is the system linear?(b) How many equilibria can this model have?(c) Which are these equilibria if u is constant and equal to 6?

(Total: 30 points)Solution:

(a) The system is not linear as it contains a second-order term (x22).

(b) An equilibrium state is a situation where the system doesn’t change its behaviour, so the deriva-tives are set to 0:

x1x2 + x22 = 0

x1x2 ! 5x2 + u = 0

from the first equation we obtain

x1x2 + x22 = 0" x2(x1 + x2) = 0

This equation has two solutions: The first is

x1 = !x2

And the second is:x2 = 0

For the first solution:We substitute x1 = !x2 into the second equation:

!x22 ! 5x2 + u = 0" x2

2 + 5x2 ! u = 0

The polynomial has two solutions:

x2 =!5±

#25 + 4u

2and, since x1 = !x2, we obtain two solutions that produce two equilibria state:

Equil. 1 : (x1, x2)a =!

5!"

25+4u2 , !5+

"25+4u2

"

Equil. 2 : (x1, x2)b =!

5+"

25+4u2 , !5!

"25+4u2

"

For the second solution:When x2 = 0 the second equation reduces to u = 0. If this is the case (i.e. u = 0) there is anequilibrium for any values of x1, that satisfy x2 = 0. This leads to an infinite number of solutions(the line x2 = 2). In case u $= 0, we end up to an impossible situation, i.e., there are no equilibriafrom this solution.In overall: If u $= 0 then we have two equilibria points ((x1, x2)a and (x1, x2)b indicated above).If u = 0 we have infinite equilibria points: The two (x1, x2)a and (x1, x2)b indicated above, andthe line x2 = 0

(c) In the specific case u = 6, system has two equilibria points:

Equil. 1 : (x1, x2)a =!

5!"

25+4#62 , !5+

"25+4#62

"= (!1, 1)

Equil. 2 : (x1, x2)b =!

5+"

25+4#62 , !5!

"25+4#62

"= (6,!6)

4

2. Given the system:x1 = x1x2 + x2

2

x2 = x1x2 ! 5x2 + u

Answer the following questions:

(a) Is the system linear?(b) How many equilibria can this model have?(c) Which are these equilibria if u is constant and equal to 6?

(Total: 30 points)Solution:

(a) The system is not linear as it contains a second-order term (x22).

(b) An equilibrium state is a situation where the system doesn’t change its behaviour, so the deriva-tives are set to 0:

x1x2 + x22 = 0

x1x2 ! 5x2 + u = 0

from the first equation we obtain

x1x2 + x22 = 0" x2(x1 + x2) = 0

This equation has two solutions: The first is

x1 = !x2

And the second is:x2 = 0

For the first solution:We substitute x1 = !x2 into the second equation:

!x22 ! 5x2 + u = 0" x2

2 + 5x2 ! u = 0

The polynomial has two solutions:

x2 =!5±

#25 + 4u

2and, since x1 = !x2, we obtain two solutions that produce two equilibria state:

Equil. 1 : (x1, x2)a =!

5!"

25+4u2 , !5+

"25+4u2

"

Equil. 2 : (x1, x2)b =!

5+"

25+4u2 , !5!

"25+4u2

"

For the second solution:When x2 = 0 the second equation reduces to u = 0. If this is the case (i.e. u = 0) there is anequilibrium for any values of x1, that satisfy x2 = 0. This leads to an infinite number of solutions(the line x2 = 2). In case u $= 0, we end up to an impossible situation, i.e., there are no equilibriafrom this solution.In overall: If u $= 0 then we have two equilibria points ((x1, x2)a and (x1, x2)b indicated above).If u = 0 we have infinite equilibria points: The two (x1, x2)a and (x1, x2)b indicated above, andthe line x2 = 0

(c) In the specific case u = 6, system has two equilibria points:

Equil. 1 : (x1, x2)a =!

5!"

25+4#62 , !5+

"25+4#62

"= (!1, 1)

Equil. 2 : (x1, x2)b =!

5+"

25+4#62 , !5!

"25+4#62

"= (6,!6)

4

Equilibrium Analysis By Heider Jeffer____________________________________________________________

Hayder ALMusawi Computational Science

ThreeGeneralTypesOfTheEquilibrium

Equilibrium Analysis By Heider Jeffer_____________________________________________________________

Hayder ALMusawi Computational Science ExampleLogisticmodel

Tofindequilibriawehavetosolvetheequation:dN/dt=0:

Thisequationhastworoots:N=0andN=K.Anequilibriummaybestableorunstable.Forexample,theequilibriumofapencilstandingonitstipisunstable;Theequilibriumofapictureonthewallis(usually)stable.

Anequilibriumisconsideredstable(forsimplicitywewillconsiderasymptoticstabilityonly)ifthesystemalwaysreturnstoitaftersmalldisturbances.Ifthesystemmovesawayfromtheequilibriumaftersmalldisturbances,thentheequilibriumisunstable.Thenotionofstabilitycanbeappliedtoothertypesofattractors(limitcycle,chaos),however,thegeneraldefinitionismorecomplexthanforequilibria.Stabilityisprobablythemostimportantnotioninsciencebecauseitreferstowhatwecall"reality".Everythingshouldbestabletobeobservable.Forexample,inquantummechanics,energylevelsarethosethatarestablebecauseunstablelevelscannotbeobserved.Now,let'sexaminestabilityof2equilibriapointsinthelogisticmodel.

Inthisfigure,populationgrowthrate,dN/dt,isplottedversuspopulationdensity,N.Thisisoftencalledaphaseplotofpopulationdynamics.If0<N<K,thendN/dt>0andthus,populationgrows(thepointinthegraphmovestotheright).IfN<0orN>K(ofcourse,N<0hasnobiologicalsense),thenpopulationdeclines(thepointinthegraphmovestotheleft).ThearrowsshowthattheequilibriumN=0isunstable,whereastheequilibriumN=Kisstable.Fromthebiologicalpointofview,thismeansthataftersmalldeviationofpopulationnumbersfromN=0(e.g.,immigrationofasmallnumberoforganisms),thepopulationneverreturnsbacktothisequilibrium.Instead,populationnumbers

Equilibrium Analysis By Heider Jeffer_____________________________________________________________

Hayder ALMusawi Computational Science increaseuntiltheyreachthestableequilibriumN=K.AfteranydeviationfromN=Kthepopulationreturnsbacktothisstableequilibrium.Thedifferencebetweenstableandunstableequilibriaisintheslopeofthelineonthephaseplotneartheequilibriumpoint.Stableequilibriaarecharacterizedbyanegativeslope(negativefeedback)whereasunstableequilibriaarecharacterizedbyapositiveslope(positivefeedback).Thesecondexampleisthebarkbeetlemodelwithtwostableandtwounstableequilibria.Stableequilibriacorrespondtoendemicandepidemicpopulations.Endemicpopulationsareregulatedbytheamountofsusceptibletreesintheforest.Epidemicpopulationsarelimitedbythetotalnumberoftreesbecausemassattackofbeetlefemalesmayovercometheresistanceofanytree.

StabilityofmodelswithseveralvariablesDetectionofstabilityinthesemodelsisnotthatsimpleasinone‐variablemodels.Let'sconsiderapredator‐preymodelwithtwovariables:(1)densityofpreyand(2)densityofpredators.Dynamicsofthemodelisdescribedbythesystemof2differentialequations:

Thisisthe2‐variablemodelinageneralform.Here,Histhedensityofprey,andPisthedensityofpredators.Thefirststepistofindequilibriumdensitiesofprey(H*)andpredator(P*).Weneedtosolveasystemofequations:

Thesecondstepistolinearizethemodelattheequilibriumpoint(H=H*,P=P*)byestimatingtheJacobianmatrix:

Equilibrium Analysis By Heider Jeffer ________________________________________________________________

Hayder ALMusawi Computational Science Third,eigenvaluesofmatrixAshouldbeestimated.Thenumberofeigenvaluesisequaltothenumberofstatevariables.Inourcasetherewillbe2eigenvalues.Eigenvaluesaregenerallycomplexnumbers.Ifrealpartsofalleigenvaluesarenegative,thentheequilibriumisstable.Ifatleastoneeigenvaluehasapositiverealpart,thentheequilibriumisunstable.Eigenvaluesareusedheretoreducea2‐dimensionalproblemtoacoupleof1‐dimensionalproblemproblems.Eigenvalueshavethesamemeaningastheslopeofalineinphaseplots.Negativerealpartsofeigenvaluesindicateanegativefeedback.ItisimportantthatALLeigenvalueshavenegativerealparts.Ifoneeigenvaluehasapositiverealpartthenthereisadirectionina2‐dimensionalspaceinwhichthesystemwillnottendtoreturnbacktotheequilibriumpoint.Thereare2typesofstableequilibriainatwo‐dimensionalspace:knotandfocus

Thereare3typesofunstableequilibriainatwo‐dimensionalspace:knot,focus,andsaddle

Equilibrium Analysis By Heider Jeffer_______________________________________________________________

Hayder ALMusawi Computational Science Stability in discrete-time models Consider a discrete-time model (a difference equation) with one state variable:

This model is stable if and only if :

wheredf/dNt istheslopeofathicklineingraphsbelow:

Equilibrium Analysis By Heider Jeffer_________________________________________________________________