You are on page 1of 4

LyapOde

Paul Henry Bryant Institute for Nonlinear Science University of California, San Diego La Jolla, CA 92093 (Ver. 2 2009.03.01) (Ver. 3 2009.04.08) (Ver. 4 2009.06.01) Copyright (C) 2009 Paul Henry Bryant LyapOde is a program for calculating the full spectrum of Lyapunov exponents from a set of ordinary differential equations (ODEs). It uses the QR decomposition method of Eckmann and Ruelle (Reviews of Modern Physics, Vol. 57, No. 3, Part1, (1985), 617). It can optionally also use the iterative QR method of Abarbanel, Brown and Kennel (International Journal of Modern Physics B, Vol. 5, No. 9 (1991), 1347-1375) which gives similar results. Jacobians of the equations are required by both methods, and these can either be obtained by a finite difference method or by integration of the differential Jacobian when this is supplied in analytic form by the user. The software also supports the calculation of Conditional Lyapunov Exponents or CLEs (see Pecora et al, Chaos Vol. 7, No. 4, (1997), 520). The CLEs are the Lyapunov exponents of a response system that receives unidirectional synchronizing stimulus from an identical drive system. Three types of stimulus are considered: continuous coupling, periodic impulse coupling, and substitution (full or fractional). More details are given in the discussion section below. The synchronizing stimulus can be applied to one or more of the variables. When any of the CLEs are positive or zero, they can be calculated in both synchronized and unsynchronized mode which typically give differing results. In the latter case the drive and response systems are allowed to freely deviate away from synchronization. Currently the software includes the equations for the standard Lorenz model, the Rossler system, the Rossler hyperchaos system, the 5-variable version of the Lorenz cyclic 1996 model, the Colpitts oscillator, and the driven Van der Pol oscillator. The Van der Pol case demonstrates the ability to analyze driven nonautonomous systems. New systems of differential equations and Jacobians can be entered into the file models.c and the software recompiled.

Compiling the software


The software can be compiled under Windows, Mac or Linux/Unix. The software was originally developed to run on a Windows machine in a console window under Visual c+ +. It is likely that it can be compiled with other Windows compilers, but this has not yet been attempted. On a Mac or on a Linux/Unix system, create a directory LyapOde and place all of the files in this directory. Open a terminal window, change the directory to LyapOde and then type make. Note that old or backup copies of any of the source files should be kept in a different directory (otherwise the makefile will try to compile

these as well). If successful this will compile all of the .c files in the subdirectory and create the executable LyapOde. On a Windows system, under Visual c++, create a new Win32 console window application as an empty project with the name LyapOde. Place all the .c files in a subdirectory of LyapOde named Source and the rest of the files in the main LyapOde directory. Run the project, and using the project menus add all of the files in Source to the project. Then build a release (rather than debug) version of the program, since this will run much faster. If successful, the executable named LyapOde.exe will appear in a subdirectory of LyapOde named Release.

Creating a new model


To create a new model you must edit the file models.c. First, create a new function containing the differential equations similar to the function derivs_r (which is for the Rossler equations), but with a new name. Note that numbering of variables and parameters should start with one, not with zero. The analytic components of the differential Jacobian can be entered into a function similar to jacob_r. This is optional, as the Jacobian can be calculated numerically by the software using finite differences. The components of the differential Jacobian are obtained by differentiation of each of the differential equations by each variable. So, for example, dJac[2][3] should be set equal to the derivative of the second equation with respect to the third variable. Then in the function setderivs you will need to create a new case similar to the ones already there. You must come up with a codename that the user can enter when the program is running that corresponds to the new set of equations. Be sure to include in setderivs the identification of derivs and jacob with the corresponding functions you created for your new model and to give values for the number of variables nvar and number of parameters npar as well as a value for the timestep. The timestep can be changed interactively when the program is running. You will also need to provide a file, with a filename ending in .par, containing in a single column all parameters (in order) followed by all initial conditions (in order). The file should be similar to the file r.par for the Rossler system. These values can also be changed interactively when the program is running. The choice of initial condition usually makes no difference, except if the system has multiple attractors. Care must also be taken to avoid initializing the system exactly on an unstable fixed point, as may occur in some systems if the variables are all initialized to zero. Normally the system can be run for a number of pre-steps to allow it to merge onto the attractor. If for some reason it is desired to avoid this transient phase, then the initial condition should lie on the attractor. If desired you can also edit the file LyapOde.c to put in a print statement that will list the codename for your new model as a possible input choice when the program is running.

Discussion:
The Jacobians are evaluated over a series of mapping intervals, which are all the same length, which is a whole number of integration time-steps, set when running the program by the user. In all cases the next interval starts where the previous one left off. If the number of time-steps per interval is too large the Jacobian may become too singular and accuracy will be lost. It will usually work with only a single time-step, although this is

probably not the best choice since it will be inefficient and the excessive processing of the data may also reduce accuracy. As a test of the accuracy of any results obtained, it is recommended that the user makes trial adjustments to the main control parameters such as the timestep results should not be sensitive to changes in these by a factor of 2 or so, if the values were well chosen. Integration of the equations is done using the standard 4th order Runge-Kutta method with fixed timestep (set by the user). Future versions may allow for variable time-step. When using finite differencing to determine the Jacobians, a central differencing method is used that greatly improves accuracy. When obtaining the Jacobians by integrating the analytic differential Jacobians, they are multiplied at each step by the Jacobian from the beginning of the interval up to that point in time. This is because the differential Jacobian is differentiated with respect to the current time variables while we need it to be with respect to the variables at the start of the interval. The Jacobian components are integrated simultaneously with the variables using the Runge-Kutta method. To activate the iterative method, set the number of recursive cycles to a small positive number, e.g. 4. These results will be displayed after the standard results along with the residual Q matrix which can be observed to converge to the identity matrix. When calculating CLEs, both drive and response systems are identical. They use the same parameters, and use the same derivs and jacob functions as are used for the ordinary Lyapunov exponent calculation. You need to choose a synchronization stimulus method by which the drive system can attempt to cause the response system to remain synchronized with it: 1) Continuous coupling: a term of the form u ( xi yi ) is added to the equation for dyi / dt , where u is a coupling strength, xi is one of the variables of the drive system and yi is the corresponding variable of the response system. Coupling may be applied to more than one variable if desired, but in the current version all coupling terms share a common coupling strength. 2) Impulsive coupling: A term of the form (1 exp( u t ))( xi yi ) is periodically added directly to the variable yi in the response system, i.e. the variable is subjected to a series of step-like shifts in value, each of which move it a fraction of the way from where it was towards the value of the corresponding drive variable. This kind of behavior can be produced by introducing a periodic series of impulsive coupling terms of the form u t (t )( xi yi ) to the equation for dyi / dt . t is the time between successive impulses and must be an integral number of integration timesteps. If necessary, the integration timestep can be changed to allow the selection of a particular desired value for t . For small coupling strength and period, the results are approximately the same as for continuous coupling with the same coupling strength. In the limit u the variable is shifted all the way to the value of the corresponding drive variable. In the program this limit can be specified by entering -1 for u . Note that in this case one of the CLEs will be driven to .

3) Substitution: In the fractional form, one or more of the variables of the response system are partially replaced, i.e. yi xi + (1 ) yi , where is the substitution fraction which is restricted to the range 0.0 to 1.0. Full substitution is activated when the fraction is set to 1.0. In that case the substituted variables are eliminated from the response system and correspondingly fewer CLEs are calculated. For the fractional case in the limit 1 , we obtain the same results as with the full substitution case, with the exponents that correspond to the substituted variables going to zero. To see this effect in the program, set the fraction to 0.999999 and compare this result to that obtained with 1.0. After calculating the CLEs with synchronized Drive and Response systems, they are calculated again while allowing these to freely deviate. They can be expected to deviate only if one or more of the CLEs is greater than or equal to zero. The two results in that case will typically be different. The first measures how strongly the two systems would like to desynchronize. (Note that it requires some small perturbation of one of the systems in order for them to actually separate.) The second characterizes the response system dynamics when it has desynchronized from the drive system and reached some attracting solution (or possibly escaped to infinity).

Testing:
Here are some papers containing values for the exponents that can be used to test the software: K. Ramasubramanian and M. S. Sririm, Physica D 139, 72 (2000), in Table I gives values for Lyapunov exponents of the Lorenz model, the driven Van der Pol oscillator, the Rossler hyperchaos system, and others. L. M. Pecora and T L Carroll, Phys Rev Lett 64, 821 (1990), in Table I gives values for full substitution CLEs for the Lorenz and Rossler systems. L. M. Pecora and T L Carroll, Phys Rev A 44, 2374 (1991), in Table I gives additional values for full substitution CLEs for the Lorenz system. T. Stojanovski et al, Phys Rev E 55, 4035 (1997), in Figs. 8-10 give the most positive CLE for the Lorenz system with impulsive coupling in the infinite strength limit (i.e. each shift moves the coupled variable all the way to the value of the corresponding drive variable. Figs 11-13 give the two most positive CLEs for the Rossler system. All of these figures are plotted as a function of impulse period. J. C. Quinn, P. H. Bryant, D. R. Creveling, S. R. Klein, H. D. I. Abarbanel, Parameter and State Estimation of Experimental Chaotic Systems using Synchronization, submitted to Phys. Rev A (2009), Fig. 5 gives the largest CLE for the Colpitts oscillator using continuous coupling as a function of coupling strength. Note that I am a coauthor of that paper, but the calculation was done by the first author using a different method.

You might also like