SymEngine Python Bindings

0.14.1 · active · verified Wed Apr 15

SymEngine.py is a Python library providing high-performance wrappers to the SymEngine C++ symbolic manipulation library. It aims to offer a fast and efficient alternative for symbolic mathematics in Python, often used as a backend for SymPy or independently. The library is actively maintained, with frequent releases that typically follow updates to the core C++ SymEngine library.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define symbolic variables, create an expression, compute a derivative, and perform substitutions using SymEngine.

import symengine
from symengine import Symbol, sin

x = Symbol('x')
y = Symbol('y')
expr = x + y**2
print(f"Original expression: {expr}")

derivative = expr.diff(y)
print(f"Derivative with respect to y: {derivative}")

# Substitution
substituted_expr = expr.subs(x, sin(y))
print(f"Expression after substituting x=sin(y): {substituted_expr}")

view raw JSON →