# Replacing one of the integrals in the multiple integral with an analytical solution

Problem consist in simplifying complicated multiple numerical integral, where I know analytical solution for a subset of them. Integrand is of the form

E^(I vecr.A + I vecrp.B + I (vecr.C + vecrp.D)) (vecr.D vecrp.C - vecr.vecrp D.C),


where vecr, vecrp, A, B, C and D are real 3-vectors. I know the analytical solution of a double integral over vecr and vecrp and I want to substitute them, so Mathematica needs to recognize that ''Integral over vecr...*Exp[...*r]->f[r]'' and ''Integral over vecrp...*Exp[...*rp]->f[rp]''. vecr is given by

vecr = {r*Sqrt[1 - μ^2]*Cos[φ],  r*Sqrt[1 - μ^2]*Sin[φ], r*μ};


and similarly for vecrp.

Problem with the brute force approach where Mathematica does this analytical calculations is that it needs too much time (I haven't seen that Mathematica finishes the calculation at all).

Solution of

Table[Integrate[ vecr[[i]]*r^2*Exp[I*veck.vecr], {φ, 0, 2*Pi}, {μ, -1,  1}, {r, 0, R}] , {i, 1, Length[vecr]}]


is

I*12*Pi*R^5*(Sin[k*R]/(k*R)^5 - Cos[k*R]/(k*R)^4 -    Sin[k*R]/(3*(k*R)^3))*veck,


where

veck = {k*Cos[φk]*Sqrt[1 - μk^2], k*Sin [φk]*Sqrt[1 - μk^2], k*μk}


For a toy-example

Integrate[y*Exp[-t], {x, 0, \[Infinity]}, {y, 1, 5}


where I know that

Integrate[y, {y, 1, 5}]


is equal to 12 I tried

a[t_] :=  HoldForm[Integrate[y*Exp[-t], {x, 0, \[Infinity]}, {y, 1, 5}]]
a[t] /. HoldForm[Integrate[y, {y, 1, 5}] -> 12]


but it doesn't work.

veck = {k*Cos[φk]*Sqrt[1 - μk^2], k*Sin[φk]*Sqrt[1 - μk^2], k*μk};
vecr = {r*Sqrt[1 - μ^2]*Cos[φ], r*Sqrt[1 - μ^2]*Sin[φ], r*μ};
partial = Table[Integrate[vecr[[i]]*r^2*Exp[I*veck.vecr], {r,0,R}],{i,1,Length[vecr]}]


which will perform your integral over r.

Then to perform the integral over the remaining two variables

Map[Integrate[#, {φ, 0, 2*Pi}, {μ, -1, 1}]&, partial]


You can look up Map in the help system and see how it is going to take each item in partial one at a time, insert that in the place of that #, and perform Integrate on that.

I am not convinced this is really going to solve your problem, but you can try this on simpler examples and see if you can convince yourself that it will let you do what you asked to do.