Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Discrete Dynamical Systems: Stability, Cobweb Diagram, Time Series Diagram, Phase Diagram, Bifurcation Diagram

Project: Home
Views: 2619
%auto typeset_mode(True, display=False)
##################### ###### Code Starts ## ##################### ##################### #Stability !D #by Sinan Kapcak #2017 ##################### x,y=var('x y') @interact def _( funct=input_box(label='$f(x)$',default=x-x^2,width=50), fipo=input_box(label='Fixed point',default=0,width=50 )): if bool(fipo == funct(x=fipo))==False: show (LatexExpr(r' x=') , fipo , LatexExpr(r' \text{ is not a fixed point.}')) else: if abs( diff(funct,x).substitute(x=fipo))<1: show (LatexExpr(r' x^*=') , fipo , LatexExpr(r' \text{ is an asymptotically stable fixed point.}')) if abs( diff(funct,x).substitute(x=fipo))>1: show (LatexExpr(r' x^*=') , fipo , LatexExpr(r' \text{ is an unstable fixed point.}')) if diff(funct,x).substitute(x=fipo)==1: A=0 n=2 while A==0: A=diff(funct,x,n).substitute(x=fipo) n=n+1 if is_odd(n)==True: show (LatexExpr(r' x^*=') , fipo , LatexExpr(r' \text{ is an unstable (semistable) fixed point.}')) else: if A<0: show (LatexExpr(r' x^*=') , fipo , LatexExpr(r' \text{ is an asymptotically stable fixed point.}')) if A>0: show (LatexExpr(r' x^*=') , fipo , LatexExpr(r' \text{ is an unstable fixed point.}' )) if diff(funct,x).substitute(x=fipo)==-1: funct1=funct(x=funct) A=0 n=2 while A==0: A=diff(funct1,x,n).substitute(x=fipo) n=n+1 if A<0: show (LatexExpr(r' x^*=') , fipo , LatexExpr(r' \text{ is an asymptotically stable fixed point.}')) if A>0: show (LatexExpr(r' x^*=') , fipo , LatexExpr(r' \text{ is an unstable fixed point.}')) ##################### ###### Code Ends #### #####################
Interact: please open in CoCalc