R/funcs_curves-equations.R

Defines functions net_linear_gradient net_linear_function linear_gradient linear_function net_s_curve_gradient net_s_curve_function s_curve_gradient s_curve_function net_dimrets_gradient net_dimrets_function dimrets_gradient dimrets_function

# Diminishing Returns ####
# Function
dimrets_function <- function(x, a, b){
      b * ( 1 - exp( -x / a ) )
}
# Gradient (Negative)
dimrets_gradient <- function(x, a, b){
      -( ( ( b / a ) * exp( -(x/a) ) ) )
}

# Net Diminishing Returns
# Function
net_dimrets_function <- function(x, a, b){
      b * ( 1 - exp( -x / a ) ) - x
}
# Gradient (Negative)
net_dimrets_gradient <- function(x, a, b){
      -( ( ( b / a ) * exp( -(x/a) ) ) ) + 1
}


# S-Curve ####
# Function
s_curve_function <- function(x, a, b, c, d){
      b * ( x / a )^c / ( ( x / a )^c + d )
}
# Gradient (Negative)
s_curve_gradient <- function(x, a, b, c, d){
      -( b * c * d * ( x / a )^c ) / ( x * ( ( x / a )^c + d )^2 )
}

# Net S-Curve
# Function
net_s_curve_function <- function(x, a, b, c, d){
      b * ( x / a )^c / ( ( x / a )^c + d ) - x
}

# Gradient (Negative)
net_s_curve_gradient <- function(x, a, b, c, d){
      - ( b * c * d * ( x / a )^c ) / ( x * ( ( x / a )^c + d )^2 ) + 1
}

# Linear ####
# Function
linear_function <- function(x, a){
      a * x
}
# Gradient (Negative)
linear_gradient <- function(x, a){
      - a
}

# Net Linear
# Function
net_linear_function <- function(x, a){
      a * x - x
}
# Gradient (Negative)
net_linear_gradient <- function(x, a){
      - a + 1
}
cath-parkinson/mm.reoptimise documentation built on May 12, 2022, 3:34 p.m.