Search code examples
rnotation

Writing a R function with vector as in- and output in math notation?


im struggling to write the following R function in math notation:

function <- function(rmm, a){
  temp <- exp(c(0.5, 1.5, 2.5)**a)*c(1,rmm[1:2])
  return(temp/sum(temp))
}

rmm is a vector of length 2.

So far I have this:

$$f(x, y, a) = \frac{e^{(0.5, 1.5, 2.5)*a}*(1, x, y)}{sum-from-above...}$$

Thank you.


Solution

  • Did you mean something like this?

    f(x, y, a) = \frac{1}{1*e^{0.5^a} +x*e^{1.5^a} + y*e^{2.5^a}} \left[ 1*e^{0.5^a}, x*e^{1.5^a}, y*e{2.5^a}\right]
    

    which produces

    sample formula

    I'm not sure how you want to represent your vector in mathematical notation. There is no one right way.