2021 - Online - In the cloud

PAGE 2021: Methodology - Other topics
Niklas Korsbo

Latexify.jl - An ecosystem for automatically transcribing Pumas and Julia objects into renderable equations.

Niklas Korsbo

Pumas-AI

Objectives: The Julia programming language can represent, modify and execute its own code. This ability is powerful when defining domain-specific languages for model specification and many packages utilise this to great effect. Another benefit is that Julia retains and presents a wealth of information about its defined objects. Here, we demonstrate how we have utilised this to enable automatic and extensible conversion of computational models and other Julia objects into typeset and renderable equations.  

Methods: Julia parses its code into expression trees that keep track of what operations need to be applied to what arguments and in what order. By providing instructions for how every such operation should be represented in a natural equation form, Latexify.jl can automatically and accurately determine how different objects could be represented in standard mathematical notation. Latexify.jl comes with an extensive set of default conversion recipes that enable the typesetting and rendering of Expressions, Strings, Symbols, Numbers and more. Apart from this, Latexify.jl comes with a recipe system that allows external packages and users to add support for their own types.  

Results:  Latexify.jl provides an extensible way of converting Julia objects into typeset equations that can be rendered in place or copied into reports. This has enabled automatic transcription and rendering of not only small expressions but of entire computational models defined using a range of different modelling packages.  For example, the full mathematical representation of even large QSP models defined in Pumas.jl, Catalyst.jl, or ModelingToolkit.jl [1, 2] can be extracted, processed and rendered in the blink of an eye.  Even though the user might specify Pumas.jl or Catalyst.jl models using a chemical arrow notation, these packages must lower the model into expressions that make sense to the computer. Since Latexify.jl is able to interpret model definitions along several different stages of lowering, it can easily toggle between outputting such a model in its original chemical arrow notation or in the differential equation notation that the model lowers into.  The most obvious benefits of Latexify.jl is that it saves time when writing reports and it minimises the risk of transcription errors. More than that though, it facilitates fully automated report generation (already available in Pumas.jl), it enables inspection of the mathematics that various modelling syntaxes lower into, and it provides an immediate visual check of models during their definition and revision.   

Conclusions: Latexify.jl extracts equations from Julia objects such as full computational models and it presents them to the user in a typeset way for inclusion into reports or for immediate visualisation and inspection. 



References:
[1] Ma, Y; Gowda, S; Anantharaman, R; Laughman, C; Shah, V & Rackaukas, C. 2021, ModelingToolkit: A Composable Graph Transformation System For Equation-Based Modeling
[2] Qing, N & Rackaukas, C, 2017, DifferentialEquations.jl – A Performant and Feature-Rich Ecosystem for Solving Differential Equations in Julia


Reference: PAGE 29 (2021) Abstr 9771 [www.page-meeting.org/?abstract=9771]
Poster: Methodology - Other topics
Click to open PDF poster/presentation (click to open)
Top