{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 3: Bifurcations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.1_1: Saddle_Node_Bifurcatio.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example 3.1.1, Page = 47\n", "// Non-Linear Dynamics and Chaos, First Indian Edition\n", "//Steven H. Strogatz\n", "// x(dot)=f(x)=r-(x^2)\n", "// Notation: x1,x2,x3........ are the fixed point solutions\n", "// since x* is an error, because of multiplication operator.\n", "\n", "clear;\n", "clc;\n", "close;\n", "\n", "for r=-1:0.1:+1 //Varying value of parameter 'r' so as to obtain bifurcation diagram.\n", " \n", " x1 = +(sqrt(r)); //First Fixed Point.\n", " x2 = -(sqrt(r)); //Second Fixed Point.\n", " f1 = -2*x1; //f'(x) at x1.\n", " f2 = -2*x2; //f'(x) at x2.\n", " \n", " //x(double dot) = f'(x) = -2*x.\n", " set(gca(),'auto_clear','off') //hold on\n", " set(gca(),'grid',[2,5])\n", " if (r<0) then\n", " y = 0; //just to draw y=0 line for r<0, as no solution\n", " disp(r)\n", " disp('No fixed points.')\n", " plot2d(r,y,style=-2)\n", " \n", " else\n", " set(gca(),'auto_clear','off')\n", " if(f1>0) //unstable solutions\n", " disp(r,x1)\n", " disp('unstable solutions')\n", " plot2d(r,x1,style=-1)\n", " \n", " end\n", " if(f1<0) //Stable solutions\n", " disp(r,x1)\n", " disp('stable solutions')\n", " plot2d(r,x1,style=-2)\n", " \n", " end\n", " \n", " set(gca(),'auto_clear','off')\n", " \n", " if(f2>0) //unstable solutions\n", " disp(r,x2)\n", " disp('unstable solutions')\n", " plot2d(r,x2,style=-1)\n", " \n", " end\n", " if(f2<0) //stable solutions\n", " disp(r,x2)\n", " disp('stable solutions')\n", " plot2d(r,x2,style=-2)\n", " \n", " end\n", " xtitle('Bifurcation Diagram','r-parameter','x*-fix points')\n", " end\n", "end\n", "disp('Clearly from the graph x=0 is bifurcation point.')\n", "set(gca(),'auto_clear','on') //hold off\n", "//End of Example" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.1_2: Saddle_Node_Bifurcatio.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Example 3.1.2 Pg 47\n", "//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007\n", "//Steven H.Strogatz\n", "\n", "clear;\n", "clc;\n", "close;\n", "set(gca(),'auto_clear','on') //hold off\n", "\n", "for(r=0:1:3) //Varying value of parameter 'r' to see number of fixed point solutions.\n", " x=-2:0.1:3;\n", " set(gca(),'grid',[2,5])\n", " set(gca(),'auto_clear','off') //hold on\n", " plot2d(x,exp(-x),style=-4)\n", " plot2d(x,r-x,style=-2)\n", " figure //to get new graphics window\n", " set(gca(),'grid',[2,5])\n", " xtitle('Graph showing Number of Fix Points','X-Axis','Y-Axis')\n", "end \n", "\n", " disp('From the graph we get intersection point')\n", " disp('And hence we got our FIXED POINT SOLUTION.')\n", " disp('Clearly from graph we get stable solution when line is below exp(-x) graph.')\n", " disp('Unstable solution when line is above exp(-x) graph.')\n", " disp('From graph we infer that :')\n", " disp('1. No Fixed Points for r<1')\n", " disp('2. One Fixed Point when r=1.')\n", " disp('3. Two Fixed Points for r>1.')\n", " disp('hence Bifurcation Point is cleraly, r(c)=1')\n", "set(gca(),'auto_clear','on')\n", "//End of Example\n", " " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.2_1: Transcritical_Bifurcation.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example 3.2.1 Page 51\n", "//Non-Linear Dynamics and Chaos, First Indian Edition, Print-2007\n", "//Steven H. Strogatz\n", "\n", "clear;\n", "clc;\n", "close;\n", "\n", "// General INTRODUCTION\n", "disp('To show their is Transcritical Bifurcation show :')\n", "disp('1. Their are always two fixed points ,')\n", "disp('And they change their Stability around Bifurcation Point.')\n", "disp('2. Hence, the nature of given equation should be Quadratic.')\n", "disp('To show this use Taylor Expansion.')\n", "// END INTRODUCTION\n", "\n", "//By Taylor Expansion of given x(dot) and neglecting order(x^3) and higher order terms we get ----\n", "//x(dot) = (1-ab)x + (1/2)(ab*b)x^2.------Let x(dot) = f(x)\n", "\n", "//Stability Analysis : Put x(dot)=f(x)=0\n", "for(a=5) //Fixing one of the two parameters (i.e 'a' And 'b')\n", " for(b=-4:0.15:3) //Varying another parameter to plot Bifurcation Diagram.\n", " \n", " x1 = 0; //First Fixed Point\n", " x2 = 2*(a*b -1)/(a*b*b); //Second Fixed Point\n", " f1 = (1-a*b); //f'(x) at x1\n", " f2 = -(1-a*b); //f'(x) at x2\n", " \n", " //x(double dot)= f'(x) = (1-ab) + a(b^2)x\n", " \n", " set(gca(),'auto_clear','off') //For 'hold on' to plot points.\n", " set(gca(),'grid',[2,5]) // To set axis\n", " if(f1>0) //Unstable fixed point.\n", " plot2d(1-a*b,x1,style=-2)\n", " end\n", " if(f1<0) //Stable Fixed point.\n", " plot2d(1-a*b,x1,style=-3)\n", " end\n", " if(f2>0) //Unstable Fixed Point.\n", " plot2d(1-a*b,x2,style=-2)\n", " end\n", " if(f2<0) //Stable Fixed Point.\n", " plot2d(1-a*b,x2,style=-3)\n", " end\n", " xtitle('Bifurcation Diagram','x-axis (1-a*b)','x*-fix points')\n", " end\n", "end\n", "disp('From Graph it is clearly visible that the two fixed points changes stability around point ab=1 ')\n", "\n", "set(gca(),'auto_clear','on') //for hold off\n", "\n", "//end of Example" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.2_2: Transcritical_Bifurcation.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example 3.2.2 Page 52\n", "//Non-Linear Dynamics and Chaos, First Indian Edition, Print-2007\n", "//Steven H. Strogatz\n", "\n", "clear;\n", "clc;\n", "close;\n", "\n", "//General INTRODUCTION\n", "disp('To show their is Transcritical Bifurcation show :')\n", "disp('1. Their are always two fixed points ,')\n", "disp('And they change their Stability around Bifurcation Point.')\n", "disp('2. Hence, the nature of given equation should be Quadratic.')\n", "disp('To show this use Taylor Expansion.')\n", "// End INTRODUCTION\n", "\n", "// u(dot) = (r+1)u - (1/2)r(u^2) + O(u^3)\n", "// u(dot) = (r+1)u - (1/2)r(u^2) + ZERO -----neglecting higher order terms\n", "// Let u(dot) = f(u)\n", "\n", "for r=-4:0.15:3 //Varying Parmater 'r' to obtain Bifurcation Diagram\n", " u1 = 0; //First Fixed Point.\n", " u2 = 2*(r+1)/r; //Second Fixed Point.\n", " f1 = (r+1); //f'(u) at u1\n", " f2 = -(r+1); //f'(u) at u2\n", " set(gca(),'auto_clear','off') //hold on\n", " set(gca(),'grid',[2,5])\n", " \n", " //u(double dot) = f'(u) = (r+1) - r*u\n", " \n", " if (f1>0) then //Unstable Fixed Point.\n", " plot2d(r+1,u1,style=-2)\n", " end\n", " if (f1<0) then //Stable Fixed Point.\n", " plot2d(r+1,u1,style=-3)\n", " end\n", " if (f2>0) then //Unstable Fixed Point.\n", " plot2d(r+1,u2,style=-2)\n", " end\n", " if (f2<0) then //Stable Fixed Point.\n", " plot2d(r+1,u2,style=-3)\n", " end\n", " xtitle('Bifurcation Diagram','x-Axis -(r+1)','u*-fix points')\n", "end\n", "set(gca(),'auto_clear','on') //hold off\n", "disp('Clearly from the Bifurcation Diagram we see that r=-1 is the bifurcation point.')\n", "//end of Example" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.4_1: Pitchfork_Bifurcatio.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example 3.4.1 Page 57\n", "//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007\n", "//Steven H. Strogatz\n", "\n", "clear;\n", "clc;\n", "close;\n", "set(gca(),'auto_clear','on') //hold off\n", "\n", "for (B=0.5:0.5:2) //Capital 'B' is denoting Beta.\n", " x=-3:0.1:3;\n", " y=x; //To plot x=y line.\n", " \n", " figure;\n", " set(gca(),'auto_clear','off') //hold on\n", " set(gca(),'grid',[2,5])\n", " plot2d(x,y,style=-4)\n", " plot2d(x,B*tanh(x),style=-1)\n", " xtitle('Intersection For different Beta values','x-Axis','y-Axis')\n", " \n", " \n", "end\n", "disp('From graph following points are clear:')\n", "disp('1. For B<1, only orign is the fixed point.')\n", "disp('2. For B>1, their are two new fixed points.')\n", "\n", "//Stability\n", "figure\n", "set(gca(),'grid',[2,5])\n", "for(x1 = -3:0.5:3)\n", " if(x1~=0)\n", " B = x1/tanh(x1);\n", " plot2d(B,x1,style=-4)\n", "end\n", "\n", "for(B=0:0.1:3);\n", " x1 = 0;\n", "if(B<1)\n", " plot2d(B,x1,style=-4) //Stable\n", "else\n", " plot2d(B,x1,style=-2) //Unstable\n", "end \n", "xtitle('Bifurcation Diagram','Beta Values-Parameter','x*-Fix Points')\n", "end\n", "end\n", "set(gca(),'auto_clear','on')\n", "//If B<1 then only one fixed point.\n", "//end of Example." ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.4_2: Pitchfork_Bifurcatio.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Example 3.4.2 Page 58\n", "//Non-Linear Dynamics and Chaos First Indian Edition Print 2007\n", "//Steven H.Strogatz\n", "clear;\n", "clc;\n", "close;\n", "set(gca(),'auto_clear','on') //hold off\n", "\n", "for(r=-1:0.5:1)\n", " x = -3:0.1:3;\n", " V = -0.5*r*(x^2)+0.25*(x^4);\n", " set(gca(),'auto_clear','off') //hold on\n", " xtitle('Potential Diagram','X-Axis','Y-Axis')\n", " plot2d(x,V,style=-4)\n", " figure\n", " set(gca(),'grid',[2,5])\n", " \n", "end\n", "set(gca(),'auto_clear','on')\n", "//End of Example" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }