Class library in C++ to compute Lyapunov functions for nonlinear systems J´ohannBj¨ ornsson Skuli Gudmundsson Sigurdur Hafstein Reykjavik University, Menntavegur 1, 101 Reykjavik, Iceland e-mail: {johannbj, skuligu, sigurdurh}@ru.is Abstract: Lyapunov functions are of fundamental importance in the stability analysis of dynamical systems. Unfortunately, the construction of Lyapunov functions for nonlinear systems is in general a very difficult problem. We present software written in C++ that computes Lyapunov functions for n-dimensional, nonlinear, time-continuous dynamical systems defined through systems of autonomous differential equations. The software implements the computation of continuous and piecewise affine (CPA) Lyapunov functions through linear programming (LP) and the computation of Lyapunov functions using radial basis functions (RBF) and collocation. In the former case a common Lyapunov function for a finite set of nonlinear systems can be computed and it is guaranteed to be a true Lyapunov function, i.e. to fulfill the defining properties of a Lyapunov function exactly and rigorously (as opposed to approximately, which is so often the case with numerically contrived results). In the latter case the computed function is smooth and is guaranteed to be a Lyapunov function outside of an arbitrary small neighbourhood of the equilibrium, if the collocation points are close enough. However, it is not obvious how to determine what is close enough. A Lyapunov property test for the CPA interpolation of the computed RBF solution is therefore also part of the software. Keywords: Lyapunov function, C++ software, stability, dynamical systems 1. INTRODUCTION The computation of Lyapunov functions has been an active field of study for decades. Earlier, much attention was spent on linear differential inclusions Brayton and Tong (1979); Wang and Michel (1996); Polanski (2000) and this is still an active field of study Lazar and Joki´ c (2010); Lazar and Doban (2011). Since the turn of the millennium several different more general approaches have appeared in the literature. For polynomial vector-fields the com- putation of polynomial Lyapunov functions has received much attention, either using the sum-of-squares (SOS) relaxation and semi-definite programming Peet (2009); Peet and Papachristodoulou (2012), introduced in Par- rilo (2000), or different methods like quantifier-elimination Burchardt and Ratschan (2007). For an overview of SOS methods we refer the reader to Anderson and Pa- pachristodoulou (2015) and for an overview of other poly- nomial methods we refer the reader to Kamyar and Peet (2015). Other approaches use graph theoretic methods Kalies et al. (2005); Ban and Kalies (2006) or other diverse methods to solve the Zubov equation Zubov (1964); Van- nelli and Vidyasagar (1985); Camilli et al. (2001); Gr¨ une (2002). For a more detailed overview of different methods to compute Lyapunov functions numerically cf. the recent review Giesl and Hafstein (2015b). There have been numerous publications on two other methods, the CPA method that uses LP to parameter- Bj¨ornsson and Gudmundsson are supported by The Icelandic Research Fund, grant nr. 130677-052 and 152429-051 respectively. ize a CPA Lyapunov function and the RBF method, a collocation method that uses radial basis functions to solve a Zubov equation numerically, a first-order partial differential equation (PDE), whose solution is a Lyapunov function for the system at hand. Recently, the advantages of both these methods were combined in Giesl and Hafstein (2015a). The RBF method is used to propose a Lyapunov function and then the constraints of the LP problem of the CPA method are verified. This delivers a method that is exact, i.e. results in a true Lyapunov function and not an approximation, and has the numerical complexity of the RBF method, which is considerably lower than that of the CPA method. In this paper we present a class library in C++ that implements both the CPA and the RBF method and the combined method from Giesl and Hafstein (2015a). In the next section we give a very brief overview of the CPA and RBF methods respectively. Then we discuss the structure of the software briefly and give five worked out examples of its use. 2. METHODS IMPLEMENTED We give a short introduction of the methods implemented. For a more detailed description we refer the reader to Hafstein (2007); Giesl and Hafstein (2014) for the CPA method and Giesl (2007) for the RBF method. For either method we consider the following autonomous system: ˙ x = f (x), where f C 2 (R n , R n ) and f (0)= 0. (1)