R/make_Mu_dlt.R

Defines functions make_Mu_dlt

Documented in make_Mu_dlt

make_Mu_dlt <- function(media) {

  expr <- gsub("\\s+", "", media)

  # --- familia potencia
  if (grepl("^at\\^", expr)) {

    p <- extract_p_power(expr)

    return(
      function(ak, ti, ti_1) {
        Mu_dlt_power(ak, ti, ti_1, p)
      }
    )
  }

  # --- familias cerradas exactas
  Mu <- switch(
    expr,
    "exp(at)" = Mu_dlt_exp,
    "cos(at)" = Mu_dlt_cos,
    "sin(at)" = Mu_dlt_sin,
    NULL
  )

  if (is.null(Mu)) {
    stop(
      sprintf(
        "Drift '%s' not recognized. Valid options are: exp(at), sin(at), at^p",
        media
      )
    )
  }

  return(Mu)
}

Try the mixediffusion package in your browser

Any scripts or data that you put into this service are public.

mixediffusion documentation built on March 20, 2026, 5:10 p.m.