# Given two non-overlapping line segments, L1 and L2, along a line, what is the expected 'functional' distance between two random points on L1 and L2?

I am trying to find the expected connectivity of two line segments, $$L_1$$,$$L_2$$, based on 'functional' distance, $$E(f(d))$$. For context, consider a fish travelling between two segments on a river where $$f(d)$$ represents the probability of the fish reaching $$L_2$$ from $$L_1$$ based on an inverse relationship with distance.

Assume that $$L_1$$ and $$L_2$$ do not overlap and are segments along the line, $$L$$. The distances between $$L_1$$ and $$L_2$$ are assumed to be from pairs of points, $$(P_1,P_2)$$, randomly drawn and uniformly distributed on each segment. The 'functional' distance, $$f(d)$$ ($$[0,1]$$) may be one of several non-linear distance functions that approach $$f(d)=0$$ as $$d$$ increases.

Without a distance function, I believe $$E(d)$$ is simply the distance from the midpoints of $$L_1$$ and $$L_2$$; it should be the centroid of a rectangle, $$(P_1,P_2)$$, formed from the set of all possible point-pairs. I am concluding that from this answer, which seems applicable because the random points on $$L_1$$ and $$L_2$$ are uniformly distributed and independent, therefore $$(P1,P2)$$ is uniformly distributed on a rectangle.

However, how do I evaluate $$E(f(d))$$? The probability distribution of all $$d$$'s intuitively seems symmetrical and centred on $$E(d)$$ but in contrast it seems that $$(f(d))$$ is probably asymmetrical. intuitively it seems it will lead to a problem where integrating (f(d)) is required.

I am assuming this is more tractable than the related question asked and answered here. If I understand it correctly, my situation is simplified because $$L_1$$ and $$L_2$$ are assumed to be aligned along $$L$$ and do not overlap. This is well outside my area of expertise, so any help is much appreciated.

It's a bit misleading to call it a distance, isn't it, if $$f(0) \not= 0$$? Just say it's a function.
Anyway, if I understand you correctly, suppose $$L_1 = [a, b]$$ and $$L_2 = [c, d]$$ with $$L1 \cap L2 = \varnothing$$. Suppose $$X_1$$ and $$X_2$$ are points drawn uniformly (and independently) from $$L_1$$ and $$L_2$$ respectively. Then
$$E(f(|X_2-X_1|)) = \frac{1}{(b-a)(d-c)} \int_{x_1=a}^b \int_{x_2=c}^d f(|x_2-x_1|) \,dx_2 \,dx_1$$
with the usual assumptions of integrability. Without knowing more about what $$f$$ does, it's hard to say much more than that, I suspect.
ETA: Things don't change much if we remove the assumption that the function is invariant under translation, or that it's symmetric with respect to its two implicit arguments. Just replace $$f(|X_2-X_1|)$$ and $$f(|x_2-x_1|)$$ with $$f(X_1, X_2)$$ and $$f(x_1, x_2)$$, respectively.