# Extracting a logarithmic divergence of an expression using Series

Consider the following expression:

expr = ((3 M - r0) (4 Cos[θ]^2 (25 M - 11 r0
+ (-3 M + r0) Cos[2 θ]) EllipticE[(4 (-2 M + r0) Sec[θ]^2)/(3 M - r0)]
+ 4 (-19 M + 9 r0 + (-3 M + r0) Cos[2 θ]) EllipticK[(4 (-2 M + r0) Sec[θ]^2)/(3 M - r0)] Sin[θ]^2)
)/(4 π r0^3 Sqrt[Cos[θ]^2] (-8 M + 4 r0 + (-3 M + r0) Cos[θ]^2)^2);


where $$r_0 > 3M > 0$$ are some parameters. I know that this expression diverges logarithmically as $$\theta \to \pi/2$$. One quick way to see this is by picking specific values for $$r_0$$ and $$M$$. For example:

Series[expr /. r0 -> 4 /. M -> 1, {θ, π/2, 0}, Assumptions -> θ > π/2]


I am having a lot of trouble however doing this for general $$r_0$$ and $$M$$. Specifically, simply evaluating

Assuming[{θ > π/2, r0 > 3 M > 0}, Simplify[Series[expr, {θ, π/2, 0}]]]


and Mathematica has trouble giving me the explicitly expression. Is there a better way to do this?

• If Limit[expr, \[Theta] -> Pi/2, Assumptions -> {r0 > 3 M > 0}] give me: -\[Infinity] and Series[expr /. r0 -> 4 /. M -> 1, {\[Theta], \[Pi]/2, 0}, Assumptions -> \[Theta] > \[Pi]/2] give me: SeriesData[\[Theta], Rational[1, 2] Pi, {Rational[1, 2048] Pi^(-1) ( 20 2^Rational[1, 2] - 4 2^Rational[1, 2] Log[ 2] - 2^Rational[1, 2] Log[ 8] + 2 2^Rational[1, 2] Log[ Rational[-1, 2] Pi + \[Theta]])}, 0, 1, 1] on Mathematica 13.0. Jun 2, 2022 at 14:49
• Yes, that is correct. Hence the logarithmic divergence. Jun 2, 2022 at 15:20
• I'm unsure what you want. How's Limit[expr/Log[\[Theta] - \[Pi]/2], \[Theta] -> Pi/2, Assumptions -> {r0 > 3 M > 0}]? Jun 2, 2022 at 16:21
• @MichaelE2 yes that works. For some reason, I convinced myself it did not... Jun 2, 2022 at 16:25

Another possibility is to use the new in M12.1 function Asymptotic:

asym = Assuming[
r0 > 3 M > 0 && θ > Pi/2,
Simplify @ Asymptotic[expr, θ -> Pi/2]
]
Coefficient[asym, Log[θ - Pi/2]] //Simplify


(Sqrt[(3 M - r0)/( 2 M - r0)] (28 M - 12 r0 - 12 M Log + r0 Log + (-3 M + r0) Log[(8 M - 4 r0)/( 3 M - r0)] + (6 M - 2 r0) Log[-(π/2) + θ]))/(8 π (2 M - r0) r0^3)

((3 M - r0)/(2 M - r0))^(3/2)/(4 π r0^3)

Method 1:

If a function, $$f(x)$$, is known to have an expansion of the form $$f(x) = a + b \log(x) + \mathcal{O}(x),$$ then $$\lim\limits_{x \to 0}xf'(x)=b$$.

So, for my example, first compute the derivative of the expressions:

exprD = D[expr, θ] // FullSimplify;


Then

Assuming[{θ > π/2, r0 > 3 M > 0}, Simplify[Series[exprD (θ - π/2), {θ, π/2, 1}]]]


and this extracts the coefficient of the logarithmic term.

Method 2: as suggested by @MichealE2, simply perform the approriate limit

Limit[expr/Log[θ - π/2], θ -> Pi/2, Assumptions -> {r0 > 3 M > 0}]


Here's another way:

Assuming[{θ > π/2, r0 > 3 M > 0},
Simplify@
CoefficientList[Simplify@Series[expr, {θ, π/2, 1}],
Log[-(π/2) + θ]][]
]

(*  ((3 M - r0)/(2 M - r0))^(3/2)/(4 π r0^3)  *)


The key here is to ask for a higher-order expansion than is strictly necessary. I'm not sure why it fails with order 0, but it's been this way (for log poles, for instance) for years. Sometimes you need to raise the order, sometimes you don't.