# Definite double integral in Mathematica

I am a beginner in Mathematica. I want to perform the following definite double integral equation in Mathematica and want to compare the solution with mine.

$$A_{P-A} = R^2\int_{\theta=\frac\pi2-\beta}^{\alpha_\text{eq}}\int_{\phi=\arcsin(1/\tan\beta\tan\theta)}^{\pi-\arcsin(1/\tan\beta\tan\theta)}\sin\theta\mathrm{d}\theta\mathrm{d}\phi$$

$$A_{P-A} = \pi R^2(1-\cos\alpha_\text{eq})+2R^2\left[\cos\alpha_\text{eq}\arcsin(\cot\beta\cot\alpha_\text{eq})-\arctan\frac{\cos\beta}{\sqrt{\sin^2\beta-\cos^2\alpha_\text{eq}}}\right]$$

I wrote the command by following Mathematica tutorial for the integral and it is not showing any result and keep running for over 2 hours. Am I making any mistakes?

R^2 Integrate[
Sin[\[Theta]], {\[Theta], (Pi/2), \[Alpha] }, {\[Phi],
ArcSin[1/(Tan[\[Theta]]*Tan[\[Beta]])],
Pi - ArcSin[1/(Tan[\[Theta]]*Tan[\[Beta]])]}]

• People here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful Feb 24, 2019 at 22:33
• Thanks for your suggestion. Here I made the edit. Feb 24, 2019 at 23:31
• Maybe the GenerateConditions -> False option will do the trick. Feb 25, 2019 at 9:25

(leaving out the global $$R^2$$ multiplier)

First step: definite integration over φ:

A = Integrate[Sin[ϑ], {φ, ArcSin[1/(Tan[ϑ]*Tan[β])],
Pi - ArcSin[1/(Tan[ϑ]*Tan[β])]}] // FullSimplify


2 ArcCos[Cot[β] Cot[ϑ]] Sin[ϑ]

Second step: indefinite integration over ϑ:

B[β_, ϑ_] = Integrate[A, ϑ, GenerateConditions -> False] // FullSimplify


(lengthy output)

Third step: insert integration boundaries. I think that here's the tricky bit that stumps the automatic integration you've been running for hours. Manually taking the limit at the lower boundary (implicitly assuming that $$\pi/2-\beta<\alpha$$):

J[α_, β_] = B[β, α] - Limit[B[β, ϑ], ϑ -> π/2 - β, Direction -> "FromAbove"]


(lengthy output)

Here's a numerical example to suggest that this result gives the same answer as a numeric integration and as your result formula:

With[{α = 1.3, β = 0.3},
{J[α, β],
NIntegrate[2 ArcCos[Cot[β] Cot[ϑ]] Sin[ϑ], {ϑ, π/2 - β, α}],
π (1 - Cos[α]) + 2 (Cos[α] ArcSin[Cot[β] Cot[α]] - ArcTan[Cos[β]/Sqrt[Sin[β]^2 - Cos[α]^2]])}]


{0.0170522 - 6.66134*10^-16 I, 0.0170522, 0.0170522}

• The OP's integral looks awfully like the volume of a sphere slice, so I'm not sure about your divergence claim. Feb 25, 2019 at 9:46
• Yes I think I managed to confuse myself here... Feb 25, 2019 at 9:49
• @J.M.iscomputer-less Yes it is to calculate segment area of a sphere that I posted here math.stackexchange.com/questions/3124391/… . Feb 25, 2019 at 18:08