Enhancing SymPy Algorithms with MatchPy's Efficient Pattern Matching
Francesco Bonazzi
SymPy and MatchPy are powerful, open-source Python libraries for symbolic mathematics and pattern matching, respectively.
While SymPy excels in symbolic manipulation, its built-in pattern matching can be limiting for complex tasks. MatchPy, designed for associative-commutative (AC) pattern matching, offers a unique advantage: its data structures enable the simultaneous matching of multiple patterns against a symbolic expression with only a single tree traversal, significantly boosting efficiency.
This talk presents an experimental module that integrates these libraries, demonstrating how MatchPy's capabilities can enhance SymPy's algorithms. We will explore practical applications, including improved equation solving, derivative and integral computations, and differential equation solutions. Notably, we will showcase an experimental implementation of the RUBI integration algorithm, illustrating how MatchPy simplifies the application of intricate integration rules.
This work highlights the benefits of combining these tools, fostering the development of more robust and efficient symbolic computation workflows.
SymPy website: https://sympy.org/
MatchPy documentation: https://matchpy.readthedocs.io/en/latest
SymPy paper: https://peerj.com/articles/cs-103/
MatchPy paper: https://arxiv.org/abs/1710.06915