tags:

views:

55

answers:

4

Is this proposition true?

For all functions f
f(a+b) = f(a) + f(b).

If yes then why? If no then what are those special functions called and what property do they have?

EDIT: Wow i think floor/celing functions do not hold the property.? I can think of counterexamples but could somebody please prove this. But what are the functions that hold this property called?

A: 

In procedural programming this is not true, since arbitrary functions can have arbitrary side-effects.

For example, you could have a global counter that is incremented every time you call f() and added to the return value.

jeffamaphone
Even in purely functional languages, not every function is a homomorphism.
Dario
A: 

Does log(a+b) = log(a) + log(b)?

Dingo
another simple (counter)example is f(x) = x^2.
Jonas
A: 

No.

They are called linear if also f(k * a) = k * f(a).

In general such a function is called a homomorphism, but this is not limited to addition.

starblue
+4  A: 

You mention a function f for which:

f(a + b) = f(a) + f(b)

Such a function is called a Homomorphism, and it can be defined on certain algebraic structures. In this case + is a special binary function that maps a and b onto an element of the same domain.

Obviously not all functions are homomorphisms, as others have already shown you.

Stephan202