Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to program my own activation function for a neural network.

I am trying to do the same thing as for the Bipolar sigmoid function in this example but for the hyperbolic tangent.

This is how its done for the bipolar sigmoid function: $$ f(x) = {2 \over (1 + e^{-\alpha x} ) - 1} $$

$$ f'(x) = {\alpha (1 - f(x) f(x) )\over 2 } $$

With $y = f(x)$ $$ f'(y) = {\alpha (1 - y y )\over 2 } $$

For the hyperbolic tangent $$ f(x) = tanh(x) $$

$$ f'(x) = sech^2(x) $$

$$ f'(y) = ?? $$

How can I find f '(y) ?

share|cite|improve this question
up vote 0 down vote accepted

If you mean what I think you mean (turning a derivative into a differential equation basically):

$$f'(x)=sech^2 x = 1 - tanh^2 x = 1- f(x)^2 $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.