Related only to the post above:
When a function is concave, it has the property that
and all wi are all positive
This is called Jensen's inequality. The inequality reverses if the function is convex.
In general, a function is concave if
If the function is differentiable, this condition translated to

This is satisfied by sinx in the interval
