What's Changed
- Expanded support for differential operators via backend 1.5.0 by MilesCranmer in https://github.com/MilesCranmer/PySR/pull/782
e.g., say we wish to integrate $\frac{1}{x^2 \sqrt{x^2 - 1}}$ for $x > 1$:
python
import numpy as np
from pysr import PySRRegressor, TemplateExpressionSpec
x = np.random.uniform(1, 10, (1000,)) Integrand sampling points
y = 1 / (x**2 * np.sqrt(x**2 - 1)) Evaluation of the integrand
expression_spec = TemplateExpressionSpec(
["f"], "((; f), (x,)) -> D(f, 1)(x)"
)
model = PySRRegressor(
binary_operators=["+", "-", "*", "/"],
unary_operators=["sqrt"],
expression_spec=expression_spec,
maxsize=20,
)
model.fit(x[:, np.newaxis], y)
which should correctly find $\frac{\sqrt{x^2 - 1}}{x}$.
**Full Changelog**: https://github.com/MilesCranmer/PySR/compare/v1.2.0...v1.3.0