Depuis 1979, les calculatrices scientifiques HP — HP-34C, HP-15C, HP-42S — intègrent un algorithme de quadrature numérique développé par William Kahan, mathématicien chez HP et futur lauréat du prix Turing (1989).
L'idée centrale : une substitution cubique transforme l'intervalle [a, b] de sorte que la dérivé disparait aux bornes. La fonction n'est donc jamais évaluée aux points singuliers — ce qui permet d'intégrer des fonctions comme 1/√x ou ln(x) sans traitement spécial.
Sur la variable substituée, on construit le tableau de trapèzes en réutilisant les points des niveaux précédents, puis on applique l'extrapolation de Richardson (Romberg) pour une convergence extrêmement rapide sur les fonctions régulières.
Ce fichier C++ est une implémentation autonome, documentée et compilable directement. Modifiez simplement f(x) et les bornes, compilez, exécutez.
Since 1979, HP scientific calculators — HP-34C, HP-15C, HP-42S — have used a numerical quadrature algorithm designed by William Kahan, HP mathematician and future Turing Award laureate (1989).
The core idea: a cubic substitution remaps the interval [a, b] so that the derivative vanishes exactly at the endpoints. The function is therefore never evaluated at singular points — allowing integration of functions like 1/√x or ln(x) with no special handling.
On the substituted variable, a trapezoid table is built by reusing points from previous levels, then Richardson extrapolation (Romberg) is applied for extremely fast convergence on smooth functions.
This C++ file is a self-contained, documented, directly compilable implementation. Simply edit f(x) and the bounds, compile, and run.
Compile : g++ kahan.cpp -o kahan Run : ./kahan