Skip to main content
1 of 4
Michael E2
  • 244.7k
  • 18
  • 351
  • 774

While the unknown g might or might not be amenable to this approach, it's really fast on g == 1:

Expectation[
  1, {x1, x2, x3, x4} \[Distributed] 
   MultinormalDistribution[muvec, sigmat]] // RepeatedTiming

(23000 times faster than NIntegrate.)

Then there's also NExpectation to try, too.

Michael E2
  • 244.7k
  • 18
  • 351
  • 774