You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There should be a way to return an unevaluated derivative from within the _derivative_ or _tderivative_ method of a BuiltinFunction. Perhaps by returning None, like _eval_ does for remaining unevaluated. As of now returning None causes a segmentation fault.
This is important because for multivariate functions often only the derivative with respect to one variable may be known, so we want to return the unevaluated derivative if it's taken with respect to a variable in which we don't know the derivative. Right now it seems the only way to not return an evaluated derivative is to raise an exception.
This issue was discussed before. We have the functionality in FDerivativeOperator, it's just not available on top level or as a method on BuiltinFunction instances:
I thought this stuff was on trac somewhere already, but I cannot find it presently. For archival purposes:
from sage.symbolic.operators import FDerivativeOperator
class Doperator:
def __init__(self,vars=None):
self.vars= [] if vars is None else vars
def __call__(self,f):
return FDerivativeOperator(f,self.vars)
def __getitem__(self,i):
if isinstance(i,tuple):
newvars=self.vars+list(i)
else:
newvars=self.vars+[i]
return Doperator(newvars)
D=Doperator()
With that code one can input the form that sage prints:
There should be a way to return an unevaluated derivative from within the
_derivative_
or_tderivative_
method of aBuiltinFunction
. Perhaps by returningNone
, like_eval_
does for remaining unevaluated. As of now returningNone
causes a segmentation fault.This is important because for multivariate functions often only the derivative with respect to one variable may be known, so we want to return the unevaluated derivative if it's taken with respect to a variable in which we don't know the derivative. Right now it seems the only way to not return an evaluated derivative is to raise an exception.
CC: @burcin
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/15021
The text was updated successfully, but these errors were encountered: