# Revision history [back]

### Defining differential operator that acts like curl

Hello,

As a newbie in using SAGE (experience with Python and Numpy), I was wondering how to define a differential operator that acts like curl (or $\nabla \times \vec F$). The curl for a vector field $\vec F=(F_x,F_y, F_z)$is defined as a determinant $\mathrm{det} (\nabla,\vec F)$. I want to define such operators that act on $F_x, F_y, F_z$ without calculating the determinant a priori. In other words if I was to multiply $\frac {\partial }{\partial x}$ with $F_y$, I would expect to get $\frac{\partial F_y}{\partial x}$

Thanks

Hello,

As a newbie in using SAGE (experience with Python and Numpy), I was wondering how to define a differential operator that acts like curl (or $\nabla \times \vec F$). The curl for a vector field $\vec F=(F_x,F_y, F_z)$is defined as a determinant $\mathrm{det} (\nabla,\vec F)$. I want to define such operators that act on $F_x, F_y, F_z$ without calculating the determinant a priori. In other words if I was to multiply $\frac {\partial }{\partial x}$ with $F_y$, I would expect to get $\frac{\partial F_y}{\partial x}$x}$EDIT: Thanksclass DiffOpp(SageObject): def __init__(self, dep_var): self.dep_var = dep_var def __mul__(self, f): return diff(f, self.dep_var)  ### Defining differential operator that acts like curl Hello, As a newbie in using SAGE (experience with Python and Numpy), I was wondering how to define a differential operator that acts like curl (or$\nabla \times \vec F$). The curl for a vector field$\vec F=(F_x,F_y, F_z)$is defined as a determinant$\mathrm{det} (\nabla,\vec F) $. I want to define such operators that act on$F_x, F_y, F_z$without calculating the determinant a priori. In other words if I was to multiply$\frac {\partial }{\partial x}$with$F_y$, I would expect to get$\frac{\partial F_y}{\partial x}\$ EDIT:

class DiffOpp(SageObject):

class DiffOpp(SageObject):

def __init__(self, dep_var):
self.dep_var = dep_var

def __mul__(self, f):
return diff(f, self.dep_var)