Code for Mathematical Modeling paper