As I understand NIntegrate does some symbolic preprocessing of inputs before it actually goes ahead and numerically integrates. I'm wondering if there is some way to access this intermediate preconditioned form.
Let me demonstrate:
expr[a_, b_, c_] = -((a xp + b yp - c zp)/Sqrt[(0.5` - xp)^2 + yp^2 + zp^2]);
dom = Triangle[{{0.`, 0.`, 1.`}, {0.25, 0.8, 0.4}, {-0.7, 0.5, 0.4}}];
Timing[NIntegrate[expr[1,2,3], {xp, yp, zp} \[Element] dom]]
Timing[NIntegrate[expr[1,2,3], {xp, yp, zp} \[Element] dom,
Method -> {Automatic, "SymbolicProcessing" -> 0}]]
{0.03125, 0.474964}
{0.21875, 0.47448}
As you can see there's a healthy performance gain when allowing NIntegrate to precondition its inputs.
I need to compute thousands+ of similar integrals over different domains and different parameters. It would be nice if I could get access to this preconditioned form so I could inject my parameters directly into that or perhaps compile it, rather than duplicating this simplification step each time.
NIntegrate
. $\endgroup$