Changing the polarity/sign of a second derivative is such a well-known concept that we have a name for that: “an inflection point”.

My suggestion is simply that if you line up all your brightnesses as a function; where brightness is y and “which count in the list it’s at” is x, then don’t have any inflection points in that function. Which is a matter of picking the right values of brightness, in series, and padding them with tweening values, or removing items, as appropriate.

]]>I am sorry, but the sentence above is as incomprehensible

for mathematics as it is for other people.

Derivative is a measure of the slope, so

“derivative of the slope” is just a tautology.

As for “reverse the polarity” I assume it came from here:

http://tvtropes.org/pmwiki/pmwiki.php/Main/ReversePolarity

There is no such thing as “polarity of the derivative”.

Judging from the example, you probably wanted to say

that the derivative should be monotonic,

or in other words, that the second derivative should be positive.

Please look up, e.g. Wikipedia or Wolfram articles

on the subject.