In the following example Function is used as a base class for
my_func that represents a mathematical function my_func. Suppose
that it is well known, that my_func(0) is 1 and my_func at infinity
goes to 0, so we want those two simplifications to occur automatically.
Suppose also that my_func(x) is real exactly when x is real. Here is
an implementation that honours those requirements: