I would like to numerically integrate an equation such as the one below in which there are symbolic constant coefficients. I used a very simple code but it doesn't work in general, that tried to deal with constant coefficients with patterns. Is there any general approach to NIntegrate where symbolic constant coefficients exist?
11.94` a[1, 1]^2 Cos[x]^2 Cos[θ]^2 +
21.31` c[1, 1]^2 Cos[x]^2 Cos[θ]^2 +
0.14702` a[1, 1] b[1, 1] Cos[x] Cos[θ]^2 Sin[x] - (
1.395` b[1, 1]^2 Cos[x] Cos[θ]^2 Sin[x])/(1 + x/2)^3 +
0.4669` b[1, 1]^2 Cos[θ]^2 Sin[x]^2 + (
1.395` b[1, 1]^2 Cos[θ]^2 Sin[x]^2)/(1 + x/
2)^4 /.
{b[a1_, a2_] b[a3_, a4_] g_ :> b[a1, a2] b[a3, a4] NIntegrate[g, {θ, 0, 2}, {x, 0, 1}],
a[a1_, a2_] a[a1_, a2_] g_ :> a[a1, a2] a[a1, a2] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}],
a[a1_, a2_] a[a3_, a4_] g_ :> a[a1, a2] a[a3, a4] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}],
b[a1_, a2_] b[a1_, a2_] g_ :> b[a1, a2] b[a1, a2] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}],
c[a1_, a2_] c[a1_, a2_] g_ :> c[a1, a2] c[a1, a2] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}],
a[a1_, a2_] b[a3_, a4_] g_ :> a[a1, a2] b[a3, a4] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}],
a[a1_, a2_] c[a3_, a4_] g_ :> a[a1, a2] c[a3, a4] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}],
b[a1_, a2_] c[a3_, a4_] g_ :> a[a1, a2] a[a3, a4] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}],
c[a1_, a2_] c[a3_, a4_] g_ :> c[a1, a2] c[a3, a4] NIntegrate[g, {θ, 0, 2}, {x, 0, 1},
Method -> {Automatic, "SymbolicProcessing" -> 0}]
} // Timing
Integrate
( !..:-) .. $\endgroup$