  We provide algorithms for computing a Lyapunov function for a class of
systems where the state trajectories are constrained to evolve within a closed
convex set. The dynamical systems that we consider comprise a differential
equation which ensures continuous evolution within the domain, and a normal
cone inclusion which ensures that the state trajectory remains within a
prespecified set at all times. Finding a Lyapunov function for such a system
boils down to finding a function which satisfies certain inequalities on the
admissible set of state constraints. It is well-known that this problem,
despite being convex, is computationally difficult. For conic constraints, we
provide a discretization algorithm based on simplicial partitioning of a
sim-plex, so that the search of desired function is addressed by constructing a
hierarchy (associated with the diameter of the cells in the partition) of
linear programs. Our second algorithm is tailored to semi-algebraic sets, where
a hierarchy of semidefinite programs is constructed to compute Lyapunov
functions as a sum-of-squares polynomial.
