0
$\begingroup$

I was wondering if I can define an abstract differential operator $X$, that is just an operator that when applied to any function, it satisfies the Leibniz rule, is linear and gives $0$ when applied to a constant.

Her's my attempt

ClearAll[X, f, g, a, b, x]
LinearOperatorQ[X] := LinearOperatorQ[X] = True;
Linearity[X] := {X[a_ f_ + b_ g_] :> a X[f] + b X[g]};
LeibnizRule[X] := {X[f_ g_] :> f X[g] + g X[f]};
ConstantFunctionQ[c_] := NumericQ[c];
ConstantRule[X] := {X[c_ /; ConstantFunctionQ[c]] :> 0};

(* Define the operator X with its rules *)
X /: LinearOperatorQ[X];
X /: ConstantRule[X];
X /: Linearity[X];
X /: LeibnizRule[X];

X[f[x,y,z]*g[x,y,z]]

However the code doesn't work, do you have any tips to improve it?

New contributor
DanLee is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
2
  • 1
    $\begingroup$ btw, it is not a good idea to name your functions with UpperCase first letter. These are meant for Mathematica's use. Any one looking at your code would now think these functions are builtin functions in Mathematica. This is just the standard. So always start your function names with lower case. $\endgroup$
    – Nasser
    Commented 2 days ago
  • $\begingroup$ see related how-to-define-a-differential-operator $\endgroup$
    – Nasser
    Commented 2 days ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.