I have two normal distributions A and B. I am trying to write a program that will take mean(A), stddev(A), mean(B), stddev(B) and output the result of the following equation: $$ \int_{-\infty}^{\infty} CDF_A(x) - CDF_B(x)\,dx $$ Is there some closed-form equation to calculate this? If not, is there a nice way to break it down to get a good approximation?
I could just iterate over some range of x values and sum up the differences over a small delta around x, but I'd prefer a non linear time solution.
If I got your question correctly, you need to derive $W=X_1-X_2$ and then find $P(W<0$. See also here