HaloO, Doug McNutt wrote:
Well. . . I was going to let it pass but I had trouble sleeping this
> morning because of it.
Sorry.
f($x) = constant + $x
>
would certainly be considered a linear function
No, I was talking about the other linear ;)
with constant derivative but for that definition -f($x) is not the same as f(-$x). I think the appropriate term is antisymmetric to indicate -f(x) = f(-x). Examples would be sin(x), pow(x,3), 1/x, x**3.
That's a weaker property known also as even and odd functions because their power series contain only even or odd powers. Linearity means $a*f($x) == f($a*$x) && f($x+$y) == f($x)+f($y).
The statements: = - f($x) - g($x); = - g($x) - f($x); should always return the same result regardless of whether f or g is implemented as a function, a method, or a postfix operator; and that should be true even if the - operator is overloaded.
I agree. But let me explain how I arrive at that. To me there is no binary minus! -f(x) - g(x) = -f(x) + -g(x) = -g(x) + -f(x). I.e. plus is commutative. In other words overloading unary minus gives you the binary version for free. Or even better is to deeply overload unary plus to do the Ring role. Additionally implementing unary / or 1/ or so would yield the Field role. Regards, TSa. -- The Angel of Geometry and the Devil of Algebra fight for the soul of any mathematical being. -- Attributed to Hermann Weyl