Corecursive Coding of High Computational Derivatives and Power Series
Jerzy Karczmarczuk
TL;DR
This work presents a lazy, corecursive framework for computing high-order derivatives and associated power-series representations in a one-variable forward automatic differentiation setting, implemented in Haskell. It develops two intertwined models—the derivative towers $[y^{(k)}]$ and infinite power series—along with practical algorithms for arithmetic, composition, and reversion, highlighting optimization strategies and the interplay between chains and series. The Lambert $W$ function is used as a central testbed to illustrate derivative towers, series generation, and reversion, while the paper also derives lazy Stirling-type asymptotics and a Laplace-based approach to factorial expansions. The contributions emphasize readable, executable code and pedagogy, arguing that corecursive, lazy formulations reveal the structure of high-order differentiation problems and can be effectively used in scientific computing beyond traditional imperative methods.
Abstract
We discuss the functional lazy techniques in generation and handling of arbitrarily long sequences of derivatives of numerical expressions in one ``variable''; the domain to which the paper belongs is usually nicknamed ``Automatic differentiation''. Two models thereof are considered, the chains of ``pure'' derivatives, and the infinite power series, similar, but algorithmically a bit different. We deal with their arithmetic/algebra, and with more convoluted procedures, such as composition and reversion. Some more specific applications of these structures are also presented.
