I would like to fit a diffusion coefficient as function of e.g. salt, pH etc. If I use a linear combination of all variables, I will have to apply constraints because the model fails, if the diffusion coefficient will get too large or negative.

I was wondering if there exists a function that behaves similar to the logistic function (asymptotic between 0 and a certain limit) but instead it asymptotically reaches -1 and +1. In this way I would avoid constraints and bounds. At the same time, negative parameters would mean that the corresponding variables do decrease diffusion and vice versa.


Tangens Hyperbolicus behaves as you want.

Tanh formula

Tanh Graph


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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