##### ----- Power Law ----- #####
# Calculate probability density for a residence time τ given α of power law, 
# minimum and maximum residence times τ₋ and τ₊
function E_powerLaw(τ, (q, α, τ₋, τ₊, k)) # Note - destructured arguments so that all pdfs have τ as first argument and p as second
    if(τ < τ₋)
        0
    elseif(τ > τ₊)
        0
    else
        ((τ^(-α) - τ₊^(-α))*(-α+1.0)/(τ₊^(-α+1.0)-τ₋^(-α+1.0)-τ₊^(-α)*(τ₊ - τ₋)*(1.0-α)))
    end
    # else
    #     (α-1)*τ₋^(α-1)*τ^(-α)
    # end
end

# Calculate rate of hyporheic exchange [T^-1] given a ratio of hyporheic volume to channel volume (V_frac) 
# and parameters describing the pdf of the residence time distribution 
function qCalc_powerLaw(α, τ₋, τ₊, V_frac)
    V_frac/quadgk(τ -> (τ₊^(-α+1) - τ^(-α+1)- (τ₊^(-α)*(τ₊-τ)*(-α+1)))/(τ₊^(-α+1) - τ₋^(-α+1)- (τ₊^(-α)*(τ₊-τ₋)*(-α+1))), τ₋, τ₊)[1]
    # V_frac/quadgk(τ -> (-τ^(-α+1))/(- τ₋^(-α+1)), τ₋, Inf)[1]
end

##### ----- Exponential ----- #####



