In this it is mentioned as tanh(0) = 0 ; However, tanh(0) = -1 .

I’m confused. can u explain this please

In this it is mentioned as tanh(0) = 0 ; However, tanh(0) = -1 .

I’m confused. can u explain this please

tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}}

tanh(0) = \frac{1 - 1}{1 + 1} = 0

Here it is in code:

```
>>> import numpy as np
>>> np.tanh(0)
0.0
```

1 Like

Got it thank a lot. I hastly asked the question to chatgpt and gave a confusing output. Now it is clarified. Thanks a lot.

I recommend you avoid using chat tools for programming or math help.

They are just language models, not subject experts.

Certainly do not trust what they tell you.

1 Like

It’s a good point that there have been lots of articles warning that the current generation of LLMs are *not* good at math, even basic arithmetic. They are not learning to reason, just copying answers they’ve seen. That approach doesn’t work very well for math unless the example is very specific and exactly matches your particular question. And happens to be correct. Suppose their training set included some article that claimed tanh(0) = -1 or 42?

But as we know, it’s never a good idea to assume the SOTA for anything ML related is static. Maybe GPT-5 will fix the above problem. Or GPT-n for some value of n > 5.

1 Like