Skip to content

Instantly share code, notes, and snippets.

@sosiristseng
Created December 2, 2022 05:05
Show Gist options
  • Save sosiristseng/dd581f92a06a84b4e631c062eca056d6 to your computer and use it in GitHub Desktop.
Save sosiristseng/dd581f92a06a84b4e631c062eca056d6 to your computer and use it in GitHub Desktop.
Commonly used functions
##################################
### Commonly-used functions
##################################
"""
Regular Hill function
"""
hill(x, k=one(x)) = x / (x + k)
hill(x, k, n) = hill(x^n, k^n)
"""
Repressive Hill function
"""
hillr(x, k=one(x)) = hill(k, x)
hillr(x, k, n) = hill(k, x, n)
"""
expit(x)
Logistic sigmoid function. `expit(x) = 1 / (1 + exp(-x))`
"""
expit(x) = hillr(exp(-x))
"""
exprel(x, em1 = expm1(x))
Returns `x / (exp(x)-1)`
"""
exprel(x, em1=expm1(x)) = x / em1
"""
Signed sqare root
"""
sqrt_s(x) = sign(x) * sqrt(abs(x))
"""
Signed power
"""
pow_s(x, n) = sign(x) * (abs(x)^n)
"""
Signed Hill function
"""
hill_s(x, k, n) = hill(pow_s(x, n), pow_s(k, n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment