ModelingToolkit: Symbolic Calculations and Building Fast Parallel Functions

https://mtk.sciml.ai/dev/tutorials/symbolic_functions/

ModelingToolkit has been quite a bit of an enigma of a library to explain, but hopefully this new first tutorials helps people understand ModelingToolkit as a symbolic modeling language, akin to SymPy, but with a distinct Julia flavor by allowing for building fast sparse parallel functions, allowing users to directly define new primitives, and deeply integrating with the Julia SciML ecosystem and its differential equation solvers. ModelingToolkit.jl builds on SymbolicUtils to add features like differentiation, function building, and ways to represent mathematical models like ODEs and nonlinear optimization. It integrations with the rest of the SciML ecosystem as the basis for automatic discovery of physical equations and automated PDE solving via Physics-Informed Neural Networks (PINNs).

So please check out the tutorial and let us know what you think. Thanks!

21 Likes

Thanks Chris, that certainty helpful!

Just somewhat random feedback after a quick read:

  • Maybe it is easier to split the tutorial in two: i) symbolic calculations, ii) building (parallel) functions). Now the building functions part sits between a bit of on variables and expression and the remaining symbolic calculations.
  • It is surprising that a function called build_function returns an expression and not a function (at least not by default). Maybe add an explanation when a expression shoudl be preferred over a function.
  • It would be nice to alias @variables to @variable for the definition of a single variable.
  • Does it make sense to always call simplify before build_function?
1 Like