# Standard way to define a linear operator?

Say I want to define some simple linear operator. I can do this by

f[c_?NumericQ x_] := c f[x]
f[x_ + y_] := f[x] + f[y]


Or let's define a bi-linear operator instead

f[c_?NumericQ x_, y_] := c f[x, y]
f[x_, c_?NumericQ y_] := c f[x, y]
f[x_ + y_, z_] := f[x, z] + f[y, z]
f[x_, y_ + z_] := f[x, y] + f[x, z]


My problem is that I need to do this kind of things very often and then the definitions like above are repeated over and over. It would probably not be easy to describe all intended uses briefly here, but I hope that my intentions are clear. Isn't there some standard concise way to define operators with some common properties?

• Do the answers in Defining an operator with given properties and Problem with defining a simple linear operator help at all? Apr 18 '21 at 19:40
• @MarcoB I would say these answers help to build such operators from a scratch. I'm asking rather if there some higher-level ways to give an operator some standard property like linearity, Something like "Attributes[f]=bilinear wrt to numeric factors". Apr 19 '21 at 4:54
• As far as I know, there isn't any way to achieve that automatically. The implication in pointing out those answers is that, if such functionality existed, it would have been brought up before. Apr 19 '21 at 12:49