Post on 10-Mar-2018
Recap
Terminologyrecap
• Variableorstate• Differentialequation• Initialcondition• Trajectory• Parameter• Steadystate• Transientbehaviour• Perturbation• Ordinarydifferentialequations(ODE)• 3dimensionalODE
Terminologyrecap
• Phasespace/statespace• Vectorfield• Fixedpoint(stable/unstable,focus/node)• Nullcline• Saddles,separatrix• Bistability
DynamicalSystems
Yujiang.wang@ncl.ac.ukLecture3of5
Overview• Whataredynamicalsystems?• Howtointerpretadifferentialequation• Howtoanalyse differentialequationsystems• Howtosolvedifferentialequationsystems• Stabilityanalysis,multistability• Oscillatorysolutions• Parametervariations,bifurcations• Choiceofcoolstuff:Chaos,turbulence,spatio-temporalsystems,slow-fastsystems,transients,andmore.
Numericallysolvingdifferentialequations
Numericallysolvingdifferentialequations
• Why?– Veryrarethatwecananalyticallysolveequations– Implementationspeed– Convenience
• Whynot?– Sometimeslongsimulationtimes– Inaccuracies– Variationsbetweendifferentsolvers
Numericallysolvingdifferentialequations:methods
• Euler• Heun• Runge-kutta
Eulermethod
Exampleequation:dydt=f(t,y)Solvesinafixedstep(h=1)iterativemanner
Letssayinitialcondition,y0 = 1 and f(t,y)=y
Ifwestartwithy=0 attime(t)=0,howmuchdoesy changebetweent=0 andt=4?
Eulermethod
Exampleequation:dydt=f(y)Solvesinafixedstep(h=1)iterativemanner
Letssayinitialcondition,y0 = 1 and f(y)=y
Time->
Eulermethod
• Notveryaccurateifh istoolarge
Eulermethod
• Notveryaccurateifh istoolarge
• Alternatively:Notveryaccurateifthechangeiny,relativetothechangeint(i.e.h)istoolarge
Eulermethod
Eulermethod:anotherexample
Eulermethod:anotherexample
• Inphasespace
Eulermethod:code
Eulermethod• Knownasafixedstepsolversinceh isaconstant(intheseexamplesalwaysh=1)
• Easytoimplement• Predictableruntimes(scaleslinearlywithnumberoftimesteps)
• Easilyadaptedtoincorporatedelayse.g.wheredydt=f(y,t-τ)
• Easilyadaptedtoincorprate noisee.g.dydt=f(y,t)+w• Canbeslowandinaccuratecomparedtoothersolvers...
• Usesinformationfromtwopoints– Changeiny aty(t)– Changeinyatpredictedy(t+Δt)– dydt= y(t) + h/2 (f(y,t) + f(t+Δt,y+h f(y,t)))
Heun’s method
Heun’s method• Usesinformationfromtwopoints
– Changeiny aty(t)– Changeiny atpredictedy(Δt)– dydt= y(t) + h/2 (f(y,t) + f(t+Δt,y+h f(y,t)))
Heun’s method
SameasEuler’smethod• Usesinformationfromtwopoints
– Changeiny aty(t)– Changeiny atpredictedy(Δt)– dydt= y(t) + h/2 (f(y,t) + f(t+Δt,y+h f(y,t)))
Heun’s method• Usesinformationfromtwopoints
– Changeiny aty(t)– Changeiny atpredictedy(Δt)– dydt= y(t) + h/2 (f(y,t) + f(t+Δt,y+h f(y,t)))
Euler’smethod• Usesinformationfromonepoint
– Changeiny aty(t)
ComparingEulerandHeun methods
Euler Heun
Heun’s methodcode
Heun’s method
• Knownasasecondordermethod• IsmorecomputationallyexpensivethanEuler’smethodforthesamestepsize(twofunctionevaluations)
• OutperformsEuler’smethodforthesamestepsize
• Canincorporatenoise(morecomplicatedthough)• Canincorporatedelays(again,morecomplicated)• Stillnotthebestthough...
Runge Kutta• Fourthordersolver• InHeun’s methodthemeanbetweenthestartandendpointsistaken
• InRunge Kutta differentweightsaregiventodifferentpoints
Runge Kutta code
Runge Kutta’s method• Knownasafourthordermethod• IsmorecomputationallyexpensivethanEuler’smethodforthesamestepsize(fourfunctionevaluations)
• OutperformsEuler’smethodforthesamestepsize
• OutperformsHeun’s method• Canincorporatedelays(complicated)• Difficult&complicatedtoincludenoise(ongoingresearch)
Errortolerance
• Canestimatetheerrormadeateachstep(inaniterativemanner)
• Thiserroriscalledtheabsoluteerror• Canthencalculatetherelativeerror(absoluteerror/currentstate)
• WecantelltheMatlab solverswhaterrorswecantolerate:
• options =odeset(’RelTol',1e-3,’AbsTol',1e-6)ode45(@odefunc,timespan,initialConditions,options,…)
Variablestepsolvers
Finalwordsofcaution
• Whensimulatinganewsystemitisalwaysworthcheckingtheresultswithdifferentsolversanderrortolerancesettings
• Especiallywhenexpectyourdynamicstochangeslowly,butwithsuddenfastburstsofactivity
• NumericalsolutionsareALWAYSONLYANAPPROXIMATION