lorentz attractor numerical solution

Upload: mandeepsingh

Post on 04-Feb-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/21/2019 Lorentz Attractor Numerical Solution

    1/24

    1 | P a g e

    LORENZ EQUATIONS

    SEAN P.NAUGHTON,NAMRATA K.PATEL,IVANA SERIC,PRIYANKA A.SHAH,MANDEEP SINGH

    NEWJERSEY INSTITUTE OF TECHNOLOGY

    MATH450:PROJECT III

    PART I-INTRODUCTION

    1. Definition

    The Lorenz equation is a system ofordinary nonlinear differential equationswhich describes an oscillating dynamicalsystem with certain chaotic behavior. TheLorenz equations represent the convective

    motion of fluid cell which is warmed frombelow and cooled from above. The sameautonomous system can also apply to dynamosand lasers. Lorenz Attractor is a type of strangeattractor (a term coined after the 1963 paper).The Lorenz Equation describes the chaotic flowin a 3-dimensional dynamical system.

    The equations are:

    where are parameters of the system.

    Essentially, these equations describehow for small temperature variations Tat thetop and bottom of a layer of fluid causes it torise almost linearly, while larger changes resultin convective flow. Further increasing T givesrise to complex turbulent motion popularlycharacterized as chaos [1].

    2. History

    As a mathematician with a peculiarinterest in meteorology, Edward Lorenz hadaccidently stumbled upon the phenomena ofchaos. As a researcher at MassachusettsInstitute of Technology, Lorenz modeledweather as a system of twelve nonlineardifferential equations. With a belief that

    Figure 1: Diverging weather pattern in Lorenzsprintout reflecting sensitivity to the initial conditions.

    weather was governed by a set of deterministicrules such as Newtons laws accurately

    determining a planets orbit, Lorenz devised an

    algorithm displaying the physical behavior ofhis equations. Lorenz was attempting to perfecta system of mathematical equationseliminating the guesswork of weatherforecasting. He noticed that similarities wouldoccasionally arise in the meteorologicalpatterns, however noticeable differencepredominated.

    In 1961, Lorenz hastily choose toresume his system from a data point from hisprevious run rather than starting at his originalinitial conditions to obtain some quick outputs.Since the printouts were only incorporatedthree floating decimal points, Lorenz entereddata accurate only to the thousandths place

    rather than the millionths [2]. To his surprise,the results were quite drastically different. Asdisplayed in Figure 1, initially, the weatherunfolds in a rather similar fashion, howeverquickly begins to diverge until there is noresemblance whatsoever.

  • 7/21/2019 Lorentz Attractor Numerical Solution

    2/24

    2 | P a g e

    Lorenz has stumbled upon chaos, aniconoclast to the belief that approximationswould only lead to subtle, negligible differencesof the systems solution. At that instant, herealized that long-term weather forecast wasout the window, yet a new curiosity about thesystems orderly disorder had arisen [2].Despite attempts to keep the dream alive, noteven the best supercomputers of the time werecapable of accurately predicting meteorologicalconditions beyond a period of a few days.

    The aperiodicity, unpredictability,sensitive dependence on the initial conditions,and a system with no steady state inspiredLorenz to focus on a simplified model toexplain the chaotic behavior. He modeled thehydrodynamic process of convection in heated

    fluid, which is coined today as the Lorenzequations. However, even this elegant systemof equations displayed the certain strangenessthat was witnessed in his computer printouts.Upon plotting the simulated outputs, a complexbounded swirling orbit was observed. It

    traced a strange, distinctive shape, a kind ofdouble spiral in three dimensions, like abutterfly with its two wings. The shapedsignaled pure disorder, since no point orpattern of points ever reoccurred. Yet it alsosignaled a new kind of order [2]. The

    trajectory lied on some sort of a strange

    attractor.

    Just as there were skeptics in the timeof Aristotle and his empirical claim of thespherical shape of the Earth, Lorenz faced asimilar criticism. To disprove the nonbelievers,he pulled together a chaotic waterwheel as theupmost rebuttal corroborating his claim andspreading the seed of a new branch inmathematics, chaos.

    The problem that led to formulation ofthese equations comes from fluid dynamics andmeteorology. Edward Lorenz was trying tofigure out a mathematical representation ofchaotic behavior of weather. His 1963publication entitled, Deterministic Nonperiodic

    Flowcoined the phrase Butterfly Effect. Thetitle of his 1972 talk at a meeting of the AAAS

    Figure 2: The Lorenz attractor displaying thestrange chaotic behavior of the system governing a

    convective flow of a heated fluid.

    (American Association for the Advancement ofScience) was Predictability: Does the Flap of aButterfly's Wings in Brazil set off a Tornado in

    Texas? [3] which clearly captures the essenceof what the butterfly effect is i.e. smallperturbations in a chaotic system (such as theweather) can cause quite large deviations fromwhat the short-range predictions mightsuggest. In other words, the sensitivity to initialconditions is called the butterfly effect. The

    Lorenz attractor became the symbol of chaostheory, just as Mandelbrot set became thesymbol of fractal geometry. Since Mandelbrots

    work was published in 1960s as well, it waslater discovered that the Lorenz attractor, is infact, a fractal.

    3. The Original Problem

    Everything starts with the desire to forecastweather for longer periods. It is hard to give along-term weather forecast because theatmosphere is a chaotic system. A lot of workhas been put into knowing the weather inadvance, as it is of the utmost importance tomilitary, transportation industry, and othersuch groups. [5] The problem that lead to thediscovery of this system of equations was ofthermal convection in a layer heated fromabove (the Bnard problem). Lorenz assumedstress-free boundaries for the system. He

  • 7/21/2019 Lorentz Attractor Numerical Solution

    3/24

    3 | P a g e

    defined his streamfunction by assumingnonlinear disturbances in form of rollsinvariant in the y direction. For the convectivehydrodynamical problem, is Prandtl number, is the ratio of Rayleighs number and thevalue at which system bifurcates, and

    . Rayleighs numbermeasures how hard we're driving the system,relative to the dissipation. More precisely, theratio expresses a competition between g and q,(gravity and inflow). So it makes sense thatsteady rotation is possible only if the Rayleighnumber is large enough. Lorenz obtained thesystem by defining streamfunction in xz-plane. and , with and . is thedeparture of temperature from the state of noconvection, and k is the wavenumber ofperturbation. The original Lorenz system isobtained by substituting the above equations inthe equations of motion. By doing this, he wasable to demonstrate that the development ofchaos is associated with the attractor acquiringstrange properties. [4]4. The Strangeness

    The trajectories in the phase plane inthe Lorenz model of thermal convection areshown on page 2. The centers of the two loopsrepresent the two steady convections . Thetrajectories go clockwise around the left loopand counterclockwise around the right loop;the two trajectories never intersect. Thisstructure is an attractor because orbits startingwith initial conditions outside of the attractormerge on it and then follow it. The attraction is

    a result of dissipation in the system. Theaperiodic attractor, however, is unlike thenormal attractor in the form of a fixed point ora closed curve. This is because the twotrajectories on the aperiodic attractor, withinfinitesimally different initial conditions,

    follow each other closely only for a while,eventually diverging to very different finalstates. This is the basic reason for sensitivity toinitial conditions. For these reasons theaperiodic attract is called a strange attractor.An ordinary attractor forgets slightly

    different initial conditions, whereas the strangeattractor ultimately accentuates them. SinceLorenzs work, attractors of other chaotic

    systems have been studied and they all havecommon property of aperiodicity, continuousspectra, and sensitivity to initial conditions.

    5. References

    [1] Boyce W.E. and DiPrima R.C.,Elementary Differential Equations and

    Boundary Value Problems, Danvers: John Wiley& Sons, Inc., 2009.

    [2] Gleick J., Chaos: Making a New Science,New York: Penguin Books, 2008.

    [3] Hilborn, R.C. Chaos and Nonlinear

    Dynamics. (Oxford Uni-versity Press, 1994.Print.

    [4] Pijush, Kundu. Fluid Mechanics. 4th ed.London: Academic press, 2008. 528-523. Print.

    [5] Lorenz, Edward N., 1963: DeterministicNonperiodic Flow.J. Atmos. Sci., 20, 130141.

  • 7/21/2019 Lorentz Attractor Numerical Solution

    4/24

    4 | P a g e

    PART IICRITICAL POINTS AND STABILITYANALYSIS

    The Lorenz Equations are:

    For this project

    There are three critical points for the above

    system.

    . / . /Note that and only exist for .In order to perform linear stability analysis foreach of the critical points, one must linearize

    the system around these points.

    | |

    ( )

    For the values given,

    Proof that above point is globally stable for :

    The Liapunov function for the Lorenzequations can be constructed through trial and

    error. Typically, the sum of squares is theinitial starting point. Let the Liapunov functionV be formulated as below:

    { [ ] }

    Above implies global stability.

    Using the following transformation:

    Produces the following equations:

  • 7/21/2019 Lorentz Attractor Numerical Solution

    5/24

    5 | P a g e

    | |

    , -

    ,

    -

    Eigenvalues exist as purely real values

    or come in pairs of either purely imaginary orcomplex conjugates. A bifurcation of solutionsoccurs when the eigenvalues cross into theright half of complex plane. That is when *+changes sign. Thus, by looking for eigenvaluesof the form , where is real, thebifurcation point can be found.

    , -

    At the critical point, all of the eigenvalues canbe easily computed.

    Now to determine the stability of the points

    for this critical point, plugging invalues into the analytical cubic root formulasfor and gives thefollowing eigenvalues:

  • 7/21/2019 Lorentz Attractor Numerical Solution

    6/24

    6 | P a g e

    PART IIIGLOBALLY STABLE

  • 7/21/2019 Lorentz Attractor Numerical Solution

    7/24

    7 | P a g e

    PART IVGLOBALLY STABLE

  • 7/21/2019 Lorentz Attractor Numerical Solution

    8/24

    8 | P a g e

  • 7/21/2019 Lorentz Attractor Numerical Solution

    9/24

    9 | P a g e

    PART VPLOTS

  • 7/21/2019 Lorentz Attractor Numerical Solution

    10/24

    10 | P a g e

  • 7/21/2019 Lorentz Attractor Numerical Solution

    11/24

    11 | P a g e

    PART VIPLOTS

    Poincar map

  • 7/21/2019 Lorentz Attractor Numerical Solution

    12/24

    12 | P a g e

    PART VIIIPLOTS

  • 7/21/2019 Lorentz Attractor Numerical Solution

    13/24

    13 | P a g e

    PART VIIPLOTS

  • 7/21/2019 Lorentz Attractor Numerical Solution

    14/24

    14 | P a g e

  • 7/21/2019 Lorentz Attractor Numerical Solution

    15/24

    15 | P a g e

    ADDITIONAL PLOT FOR PART IV

  • 7/21/2019 Lorentz Attractor Numerical Solution

    16/24

    16 | P a g e

    PART VIIIPROBLEM 5

    Consider the Ellipsoid:

    a. Calculate along trajectories of LorenzEquations. , - , -

    , -b. Determine a sufficient condition on cso that

    every trajectory crossing isdirected inward.From part a, we get:

    , if , whichholds if lies outside the ellipsoid

    We need to choose c, s.t. V= clies outside the

    ellipsoid defined above. Writing V = cin theform of above equation, we obtain theellipsoid:

    Let (), then the ellipsoid inthe first equation is contained inside thesphere:

    Let another sphere, S2, be centered at with radius :

    Then, the first sphere is contained in S2. Thus,

    if we choose c, s.t. and

    , then

    as the trajectory

    crosses .c.

  • 7/21/2019 Lorentz Attractor Numerical Solution

    17/24

    17 | P a g e

    DISCUSSION

    PART IIIFor r

  • 7/21/2019 Lorentz Attractor Numerical Solution

    18/24

    18 | P a g e

    sensitive dependence on initial conditions justlike other chaotic systems. This means that twotrajectories initially separated by a very smalldistance will rapidly diverge from each otherwith time. In order to study this behavior, wesolved the Lorenz Equations for two nearby

    points as initial conditions. Our first initialcondition is a point x(t) = (x0 , y0, z0) from thetrajectory at time t = 60s and another is anearby point x(t) + (t) = (x0 + 0, y0 + 0, z0

    + 0) separated by the distance 0 = 10-5. (t)grows with time, which means the distancegets bigger as t . From our plots, weobserved that the neighboring trajectoriesseparate exponentially; that is, the distancegrows exponentially with time. Initially, thetwo trajectories seem coincident, as indicatedby the small difference between two points, butafter certain time period the difference gets

    larger and then they are no longer coincident. Ifwe plot log((t)) vs t, we find a curve that

    shows the exponential divergence. We observewiggles instead of straight lines because thestrength of the exponential divergence variesalong the attractor. The two trajectories cannot

    be separated by a distance greater than thelength of the attractor. Since the trajectoriesare bound to a finite domain of the attractor,and cannot escape to infinity, the distancebetween the two points can no longer grow.For larger time, as the motion continues, thedistance between the trajectories varies(decreases and increases) and creates somenoise because of the attractor.

  • 7/21/2019 Lorentz Attractor Numerical Solution

    19/24

    19 | P a g e

    APPENDIX: CODES

    THIS FIRST SECTION SHOWS THE CODE FOR CALCULATIONS DONE FOR ALL THE PLOTS ON PAGES 6TO 11AND THE CODE USED TOPRODUCE THOSE PLOTS.

    %This code uses RungeKutta method of 4th order in a vector form.

    tic %tic-toc used for benchmarking purposes to calculate execution time.clear

    clcr = ; %Appropriate value for r, depending on the problem.h = ; %Declare step size. For the project, h = 0.00001t=0:h:tf; %Create the variable vector. Value tf depending on problem.

    %initial conditions, chosen for each problem.x0 = ;y0 = ;z0 = ;

    Y = zeros(3,length(t))';Y(1,1) = x0;Y(1,2) = y0;

    Y(1,3) = z0;

    fori=1:length(t)-1k1 = [-10*Y(i,1)+10*Y(i,2),r*Y(i,1)-Y(i,2)-Y(i,1)*Y(i,3), Y(i,1)*Y(i,2)-(8/3)*Y(i,3)];k2 = [-10*Y(i,1)+10*Y(i,2),r*Y(i,1)-Y(i,2)-Y(i,1)*Y(i,3), Y(i,1)*Y(i,2)-(8/3)*Y(i,3)]+ 0.5*h.*k1;k3 = [-10*Y(i,1)+10*Y(i,2),r*Y(i,1)-Y(i,2)-Y(i,1)*Y(i,3), Y(i,1)*Y(i,2)-(8/3)*Y(i,3)]+ 0.5*h.*k2;k4 = [-10*Y(i,1)+10*Y(i,2),r*Y(i,1)-Y(i,2)-Y(i,1)*Y(i,3), Y(i,1)*Y(i,2)-(8/3)*Y(i,3)]+ 0.5*h.*k3;Y(i+1,:) = Y(i,:)+(1/6).*h.*(k1 + 2.*k2 + 2.*k3 + k4);

    end

    toc

    %Produce a plot for x(t) vs. t, y(t) vs. t, z(t) vs. tfigure1 = figure;axes1 = axes('Parent',figure1,'FontSize',16,'Position',[0.025 0.0868 0.956875 0.855]);box(axes1,'on');hold(axes1,'all');plot(t,Y(:,1),'linewidth',2)hold onplot(t,Y(:,2),'r','linewidth',2)plot(t,Y(:,3),'black','linewidth',2)xlabel('time','fontsize',16)title(['r = ',num2str(r),' Initial Conditions: x_0 = ',num2str(x0),', y_0 =',num2str(y0),', z_0 = ',num2str(z0)],'fontsize',16)legend('x(t)','y(t)','z(t)')grid onhold off

    %Produce a plot for phase plane x(t) vs. y(t)figure2 = figure;axes1 = axes('Parent',figure1,'FontSize',16,'Position',[0.025 0.0868 0.956875 0.855]);box(axes1,'on');hold(axes1,'all');plot(Y(:,1),Y(:,2),'linewidth',2)

  • 7/21/2019 Lorentz Attractor Numerical Solution

    20/24

    20 | P a g e

    hold onplot(sqrt(8/3*(27)),sqrt(8/3*(27)),'b*')plot(-sqrt(8/3*(27)),-sqrt(8/3*(27)),'b*')plot(0,0,'b*')xlabel('time','fontsize',16)title(['x vs. y; r = ',num2str(r)],'fontsize',16)legend('x(t) vs. y(t)','CP')grid onhold off

    %Produce a plot for phase plane x(t) vs. z(t)figure3 = figure;axes1 = axes('Parent',figure1,'FontSize',16,'Position',[0.025 0.0868 0.956875 0.855]);box(axes1,'on');hold(axes1,'all');plot(Y(:,1),Y(:,3),'linewidth',2)hold onplot(sqrt(8/3*(27)),27,'b*')plot(-sqrt(8/3*(27)),27,'b*')plot(0,0,'b*')xlabel('time','fontsize',16)title(['x vs. z r = ',num2str(r)],'fontsize',16)legend('x(t) vs. z(t)','CP')

    grid onhold off

    %Produce a plot for phase plane y(t) vs. z(t)figure4 = figure;axes1 = axes('Parent',figure1,'FontSize',16,'Position',[0.025 0.0868 0.956875 0.855]);box(axes1,'on');hold(axes1,'all');plot(Y(:,2),Y(:,3),'linewidth',2)hold onplot(sqrt(8/3*(27)),27,'b*')plot(-sqrt(8/3*(27)),27,'b*')plot(0,0,'b*')xlabel('time','fontsize',16)title(['y vs. z r = ',num2str(r)],'fontsize',16)legend('y(t) vs. z(t)','CP')grid onhold off

    %Produce a 3D plot for the strange attractorfigure5 = figure;hold onview([-297 107 228]);plot3(Y(:,1),Y(:,2),Y(:,3));scatter3(sqrt(8/3*(27)),sqrt(8/3*(27)),27,'m*')scatter3(-sqrt(8/3*(27)),-sqrt(8/3*(27)),27,'m*')grid on

    xlabel('x','fontsize',16)ylabel('y','fontsize',16)zlabel('z','fontsize',16)xlim([-18 18])ylim([-25 25])title(['r = ',num2str(r),' Initial Conditions: x_0 = ',num2str(x0),', y_0 =',num2str(y0),', z_0 = ',num2str(z0)],'fontsize',16)hold off

  • 7/21/2019 Lorentz Attractor Numerical Solution

    21/24

    21 | P a g e

    SECOND SECTION CONTAINS THE CODE FOR THE CALCULATIONS INVOLVING POINCAR MAP (PROBLEM 6).

    program lorenz

    integer n, iparameter (n = 100000)real x(n),y(n),z(n),t(n)real pm(n,3)real l(n,2)

    call AB(n,x,y,z,t)call poincareMap (x,y,z,t,n,pm)call interpolate(n,pm,l)

    open (77, file='xyzt.txt', status='new')do i=1, n

    write(77,50), x(i),y(i),z(i),t(i),pm(i,1),pm(i,2),pm(i,3),&& l(i,1),l(i,2)enddo

    50 format(f10.5,8x,f10.5,8x,f10.5,8x,f10.5,8x,f10.5,8x,f10.5,8x,f10.5,&& 8x,f10.5,8x,f10.5)close(77)

    print *, 't = ',t(85607),' x = ', x(85607),' y = ', y(85607),' && z = ', z(85607)

    stopend

    --------------------------------------------------------------------------subroutine AB (n,x,y,z,t)

    !Adams-Bashfourth third order explicit multi-step method.

    real x(n),y(n),z(n),t(n)real f0(3),f1(3),f2(3),f3(3)

    real s,b,rparameter (s = 10, b = 8.0/3.0, r = 28)real eparameter (e = 10**(-5))

    real tmaxparameter (tmax = 100.0)real hinteger i

    h = tmax/n

    !Initial conditions

    x(1) = 5.0y(1) = 5.0z(1) = 5.0t(1) = 0.0

    !Forward Euler O(1) for n=1 (n=0,,99999)i=1call rhs (s,b,r,x(i),y(i),z(i),f0)x(i+1) = x(i) + h*f0(1)y(i+1) = y(i) + h*f0(2)

  • 7/21/2019 Lorentz Attractor Numerical Solution

    22/24

    22 | P a g e

    z(i+1) = z(i) + h*f0(3)t(i+1) = t(i) + h

    !Adams-Bashfourth O(2) for n=2i=2call rhs (s,b,r,x(i),y(i),z(i),f1)x(i+1) = x(i) + 0.5*h*(3*f1(1) - f0(1))y(i+1) = y(i) + 0.5*h*(3*f1(2) - f0(2))z(i+1) = z(i) + 0.5*h*(3*f1(3) - f0(3))t(i+1) = t(i) + h

    !Adams-Bashfourth O(3) for n=3,,99999do i=3,n-1

    call rhs (s,b,r,x(i),y(i),z(i),f2)x(i+1) = x(i) + h/12*(23*f2(1) - 16*f1(1) + 5*f0(1))y(i+1) = y(i) + h/12*(23*f2(2) - 16*f1(2) + 5*f0(2))z(i+1) = z(i) + h/12*(23*f2(3) - 16*f1(3) + 5*f0(3))t(i+1) = t(i) + hf0 = f1f1 = f2call rhs (s,b,r,x(i),y(i),z(i),f2)

    enddo

    returnend

    --------------------------------------------------------------------------subroutine rhs (s,b,r,x,y,z,f0)

    !R.H.S. of dX/dt, X=(x,y,z)

    real f0(3)

    f0(1) = s*(-x + y)f0(2) = r*x - y - x*zf0(3) = -b*z + x*y

    returnend

    --------------------------------------------------------------------------subroutine poincareMap (x,y,z,t,n,pm)

    !For the Poincare Map, find a point directly below the z=r-1 plane and a!point directly above the z=r-1 plane.!Computations done only for time t>30.

    ! plane z=r-1 at r=28real x(n),y(n),z(n),t(n)real pm(n,3)

    real zpparameter (zp = 27.0)integer i,j,k,zz

    do j=1, npm(j,1) = 0pm(j,2) = 0pm(j,3) = 0

    enddo

  • 7/21/2019 Lorentz Attractor Numerical Solution

    23/24

    23 | P a g e

    zz = 0i = 1do k=1, n

    if ((zz .eq. 0) .and. (t(k) .ge. 30.0)) thenif (z(k) .gt. zp) then

    pm(i,1) = x(k-1)pm(i,2) = y(k-1)pm(i,3) = z(k-1)i = i + 1pm(i,1) = x(k)

    pm(i,2) = y(k)pm(i,3) = z(k)i = i + 1zz = 1

    endifendifif ((zz .eq. 1) .and. (t(k) .ge. 30.0)) then

    if (z(k) .lt. zp) thenpm(i,1) = x(k-1)pm(i,2) = y(k-1)pm(i,3) = z(k-1)i = i + 1pm(i,1) = x(k)

    pm(i,2) = y(k)pm(i,3) = z(k)i = i + 1zz = 0

    endifendif

    enddo

    returnend

    --------------------------------------------------------------------------subroutine interpolate(n,pm,l)

    !Apply linear interpolation on the two points acquired in the poincareMap!subroutine. From the line, use the point intersecting the z=r-1 plane.!This point can be analytically calculated using the geometry of the problem!involving two right triangles. This is the point used to plot the Poincare!Maps.

    !point(p,q)!Z=r-1!p=(x1-x0)/(z1-z0)*(z1-Z)+x1!q=(y1-y0)/(z1-z0)*(z1-Z)+y1

    real l(n,2)real pm(n,3)

    real zpparameter (zp = 27.0)integer i,j

    do i=1, nl(i,1) = 0l(i,2) = 0

    enddo

    i=2

  • 7/21/2019 Lorentz Attractor Numerical Solution

    24/24

    24 | P a g e

    j=1do while (pm(i,1) .ne. 0)

    l(j,1) = (pm(i,1) - pm(i-1,1))/(pm(i,3) - pm(i-1,3))*&& (pm(i,3) - zp) + pm(i,1)

    l(j,2) = (pm(i,2) - pm(i-1,2))/(pm(i,3) - pm(i-1,3))*&& (pm(i,3) - zp) + pm(i,2)

    i = i + 2j = j + 1

    enddo

    returnend

    --------------------------------------------------------------------------

    plotting code ran in MATLAB

    XYZT = dlmread('xyzt.txt'); x = XYZT(:,1); y = XYZT(:,2); z = XYZT(:,3);t = XYZT(:,4);X = XYZT(:,8); Y = XYZT(:,9);figureplot(X(2:186),Y(2:186),'k.')xlabel('x')

    ylabel('y')title('r=28, z=27, x0=5, y0=5, z0=5')

    --------------------------------------------------------------------------