aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdpoly/expressions.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/mdpoly/expressions.py b/mdpoly/expressions.py
index 6d855a3..9fa07f2 100644
--- a/mdpoly/expressions.py
+++ b/mdpoly/expressions.py
@@ -296,3 +296,22 @@ class WithOps:
def __rtruediv__(self, other: Any) -> Self:
raise NotImplementedError
+
+ # --- More operations ---
+
+ @wrap_result
+ def diff(self, with_respect_to: WithOps) -> Expr:
+ with self as expr, with_respect_to as wrt:
+ if not isinstance(wrt, Var):
+ raise AlgebraicError(
+ f"Cannot differentate {str(self.expr)} with respect to "
+ f"{str(wrt)}. We can only differentiate with respect to "
+ f"variables (type {Var}).")
+
+ # TODO: implement vector derivatives
+ return PolyPartialDiff(expr, wrt=wrt)
+
+
+ @wrap_result
+ def integrate(self, with_respect_to: WithOps) -> Expr:
+ raise NotImplementedError