Mathematica code used for numerical and analytical analyses of the fluvial inorganic carbon (IC) partitioning developed in Bertagni et al. (2024, Geophysical Research Letters). The code directly compares analytical and numerical solutions of the spatially explicit DIC mass balance along a river reach. Please feel free to reach out to matteo.bertagni@polito.it for questions.