If I understand your formula correctly, you want first determine for which indizes l,i,t
the expression min(y[i],y[t])-z[i]*z[t]
is greater or equal to x[l]
, and then sum
phil_z1_1[i]*phil_z1_1[t]
over those indizes. Strangely, there is no l
in latter expression.
Here is one way, but it is probably not the most efficient one:
set.seed(1234567)
z1 <- runif(50,min=0,max=1)
z2 <- runif(50,min=0,max=1)
m <- length(z1)
x <- rnorm(60)
n <- length(x)
y <- rnorm(50)*0.25
phil_z1_1 <- sqrt(12*(z1/z2))
args <- expand.grid(l=1:n, i=1:m, t=1:m)
args <- subset(args, x[l] <= pmin(y[i],y[t])-z1[i]*z2[t])
args <- transform(args, result=phil_z1_1[i]*phil_z1_1[t])
sum(args[,"result"])
[1] 1173920
Note that I renamed some variables, so this may not be what you wanted.