# Why Mathematica is giving "Indeterminate form"

I have an equation for effective potential (Veff). For SS=0, Mathematica gives output, if I take derivate of Veff with respect to r, then I take SS=0, Mathematica gives infinity (indeterminate form). Why I'm getting answer infinity? I'm posting here code, can anyone please help me?

    VeffSpinP[
r_, \[Theta]_] := (((-2 + r) (-LL^2 (-3 + r) + r^3 - SS^2))/(
r^3 - (-2 + r) SS^2) + (
LL^2 (-2 +
r) (r^3 (-3 + 2 r) + (-6 +
r) SS^2) Sin[\[Theta]]^2)/(r^3 - (-2 + r) SS^2)^2 + (
LL (r^3 (-5 + 2 r) - (-2 + r) SS^2) Sin[\[Theta]] Sqrt[((-2 +
r) ((LL - SS) (LL + SS) (-r^3 + (-2 + r) SS^2) +
LL^2 (r^3 + 2 SS^2) Sin[\[Theta]]^2))/(r^3 - (-2 +
r) SS^2)^2])/(r^4 - (-2 + r) r SS^2))/(
Sqrt[-2 + r] Sqrt[r] Sqrt[
1 + ((LL r^2 Sin[\[Theta]])/(r^3 - (-2 + r) SS^2) +
Sqrt[((-2 + r) ((LL - SS) (LL + SS) (-r^3 + (-2 + r) SS^2) +
LL^2 (r^3 + 2 SS^2) Sin[\[Theta]]^2))/(r^3 - (-2 +
r) SS^2)^2])^2]);

DrVeffSpinP[r_,
SS_] := -((((LL r^2)/(r^3 - (-2 + r) SS^2) +
Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 -
r SS^2))/(r^3 + 2 SS^2 - r SS^2)^2]) ((
LL^2 (-2 +
r) (r^3 (-3 + 2 r) + (-6 + r) SS^2))/(r^3 - (-2 +
r) SS^2)^2 + ((-2 + r) (-LL^2 (-3 + r) + r^3 - SS^2))/(
r^3 - (-2 + r) SS^2) + (
LL (r^3 (-5 + 2 r) - (-2 + r) SS^2) Sqrt[((-2 +
r) SS^2 (LL^2 r + r^3 + 2 SS^2 - r SS^2))/(r^3 +
2 SS^2 - r SS^2)^2])/(
r^4 - (-2 + r) r SS^2)) (-(-3 + r) r^2 SS^2 (r^3 + 2 SS^2 -
r SS^2) + LL^2 SS^2 (5 r^3 - 2 r^4 - 2 SS^2 + r SS^2) +
LL r Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 -
r SS^2))/(r^3 + 2 SS^2 - r SS^2)^2] (-r^6 +
2 r^3 SS^2 + 8 SS^4 - 6 r SS^4 + r^2 SS^4)))/(Sqrt[-2 +
r] Sqrt[r] (r^3 + 2 SS^2 -
r SS^2)^3 Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 -
r SS^2))/(r^3 + 2 SS^2 -
r SS^2)^2] (1 + ((LL r^2)/(r^3 - (-2 + r) SS^2) +
Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 -
r SS^2))/(r^3 + 2 SS^2 - r SS^2)^2])^2)^(3/2))) - ((
LL^2 (-2 +
r) (r^3 (-3 + 2 r) + (-6 + r) SS^2))/(r^3 - (-2 +
r) SS^2)^2 + ((-2 + r) (-LL^2 (-3 + r) + r^3 - SS^2))/(
r^3 - (-2 + r) SS^2) + (
LL (r^3 (-5 + 2 r) - (-2 + r) SS^2) Sqrt[((-2 + r) SS^2 (LL^2 r +
r^3 + 2 SS^2 - r SS^2))/(r^3 + 2 SS^2 - r SS^2)^2])/(
r^4 - (-2 + r) r SS^2))/(
2 Sqrt[-2 + r] r^(3/2) Sqrt[
1 + ((LL r^2)/(r^3 - (-2 + r) SS^2) +
Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 - r SS^2))/(r^3 +
2 SS^2 - r SS^2)^2])^2]) - ((
LL^2 (-2 +
r) (r^3 (-3 + 2 r) + (-6 + r) SS^2))/(r^3 - (-2 +
r) SS^2)^2 + ((-2 + r) (-LL^2 (-3 + r) + r^3 - SS^2))/(
r^3 - (-2 + r) SS^2) + (
LL (r^3 (-5 + 2 r) - (-2 + r) SS^2) Sqrt[((-2 + r) SS^2 (LL^2 r +
r^3 + 2 SS^2 - r SS^2))/(r^3 + 2 SS^2 - r SS^2)^2])/(
r^4 - (-2 + r) r SS^2))/(
2 (-2 + r)^(3/2) Sqrt[r] Sqrt[
1 + ((LL r^2)/(r^3 - (-2 + r) SS^2) +
Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 - r SS^2))/(r^3 +
2 SS^2 - r SS^2)^2])^2]) + (-((
2 LL^2 (-2 + r) (3 r^2 -

SS^2) (r^3 (-3 + 2 r) + (-6 + r) SS^2))/(r^3 - (-2 +
r) SS^2)^3) - ((-2 + r) (3 r^2 - SS^2) (-LL^2 (-3 + r) +
r^3 - SS^2))/(r^3 - (-2 + r) SS^2)^2 + (
LL^2 (r^3 (-3 + 2 r) + (-6 + r) SS^2))/(r^3 - (-2 +
r) SS^2)^2 + ((-2 + r) (-LL^2 + 3 r^2))/(
r^3 - (-2 + r) SS^2) + (-LL^2 (-3 + r) + r^3 - SS^2)/(
r^3 - (-2 + r) SS^2) + (
LL^2 (-2 + r) (-9 r^2 + 8 r^3 + SS^2))/(r^3 + 2 SS^2 -
r SS^2)^2 - (
2 LL (r^3 (-5 + 2 r) - (-2 + r) SS^2) (2 r^3 + SS^2 -
r SS^2) Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 -
r SS^2))/(r^3 + 2 SS^2 -
r SS^2)^2])/(r^4 - (-2 + r) r SS^2)^2 + (
LL (-15 r^2 + 8 r^3 -
SS^2) Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 -
r SS^2))/(r^3 + 2 SS^2 - r SS^2)^2])/(
r^4 - (-2 + r) r SS^2) - (
LL SS^2 (-5 r^3 + 2 r^4 + 2 SS^2 -
r SS^2) ((-3 + r) r^2 (r^3 + 2 SS^2 - r SS^2) +
LL^2 (-5 r^3 + 2 r^4 + 2 SS^2 - r SS^2)))/(
r (r^3 + 2 SS^2 -
r SS^2)^4 Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 -
r SS^2))/(r^3 + 2 SS^2 - r SS^2)^2]))/(Sqrt[-2 + r] Sqrt[r]
Sqrt[1 + ((LL r^2)/(r^3 - (-2 + r) SS^2) +
Sqrt[((-2 + r) SS^2 (LL^2 r + r^3 + 2 SS^2 - r SS^2))/(r^3 +
2 SS^2 - r SS^2)^2])^2]);


Here, DrVeffSpinP is the first derivative of Veff with respect to r at \theta = pi/2.

Actually, I have obtained the equation for Veff after the simplification of

f=1-2/r; Mu=1; M=1; XCP = ArcSinh[(r LL \[Mu] Sin[\[Theta]])/(r^2 \[Mu]^2 - f SS^2) +
Sqrt[(r^2 LL^2 \[Mu]^2 Sin[\[Theta]]^2)/(r^2 \[Mu]^2 -
f SS^2)^2 - (
f (LL^2 - SS^2) + (2 M )/r LL^2 Sin[\[Theta]]^2)/(r^2 \[Mu]^2 -
f SS^2)]];
VeffP = Sqrt[f] \[Mu] Cosh[XCP] + (M \[Mu] Tanh[XCP])/(
Sqrt[f] r)*((LL Sin[\[Theta]] )/(\[Mu] r) - Sinh[XCP]);

FullSimplify[VeffP]

• What do you get if you use Limit[expr, SS -> 0] instead of directly replacing SS with 0? Dec 24, 2020 at 13:29
• Actually, I want to do for SS=0, because I also need SS=0 in my further calculations. For SS=0 I will be sure that my further calculations are correct.
– MMS
Dec 24, 2020 at 13:35
• That's not an answer to my question. Dec 24, 2020 at 13:36
• Then, you could perhaps use something like Piecewise[{(* limit expression *), SS == 0}, (* normal expression *)] for further computations, where you should replace (* limit expression *) and (* normal expression *) appropriately. Dec 24, 2020 at 13:43
• You have not provided the actual code to reproduce the problem. D[VeffP, r] /. SS -> 0 does not return indeterminate Dec 24, 2020 at 14:54

Due to the even symmetry as a function of SS, we may treat SS as positive.

dVP = D[VeffP, r] /. θ -> Pi/2;

(* Check symmetry *)
dVP /. SS -> {SS, -SS} // Differences // Simplify
(*  {0}  *)

simpDVP =
Simplify[dVP /.
e : Power[_, p : 1/2 | -1/2] :>
(Simplify[e^Sign[p], SS > 0]^Sign[p]) // Factor];

simpDVP /. SS -> 0 // Simplify
(*
(-LL^2 (-3 + r) + r^2 μ^2)/(Sqrt[(-2 + r)/r] r^4 Sqrt[1 + LL^2/(r^2 μ^2)] μ)
*)

(* check value at S == 0 *)
Limit[dVP, SS -> 0]
(*
(-LL^2 (-3 + r) + r^2 μ^2)/(Sqrt[(-2 + r)/r] r^4 Sqrt[1 + LL^2/(r^2 μ^2)] μ)
*)

(* Check value at SS != 0 *)
Simplify[dVP - simpDVP, SS > 0]
(*  0  *)

• Thanks @ Michael E2 for the help, can you please also help in finding Limit[Simplify[ 1/(r (r - 2))*D[D[VeffP, \[Theta]], \[Theta]] /. \[Theta] -> Pi/2], SS -> 0], I'm getting wrong answer. I have tried using different ways but not successful.
– MMS
Jan 2, 2021 at 18:51

The code provided does not produce Indeterminate. Have you cleared prior definitions?

\$Version

(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)

Clear["Global*"]

XCP = ArcSinh[(r LL μ Sin[θ])/(r^2 μ^2 - f SS^2) +
Sqrt[(r^2 LL^2 μ^2 Sin[θ]^2)/(r^2 μ^2 -
f SS^2)^2 - (f (LL^2 - SS^2) + (2 M)/
r LL^2 Sin[θ]^2)/(r^2 μ^2 - f SS^2)]];

VeffP = Sqrt[f] μ Cosh[
XCP] + (M μ Tanh[XCP])/(Sqrt[f] r)*((LL Sin[θ])/(μ r) -
Sinh[XCP]) // FullSimplify;

(expr1 = Simplify[D[VeffP, r] /. θ -> Pi/2] /. SS -> 0) // Short


(expr2 = D[VeffP, r] /. {θ -> Pi/2, SS -> 0} // Simplify) // Short


expr1 == expr2 // Simplify

(* True *)

• thanks @Bob Hanlon for the help, I'm sorry I forget to write here, f = 1 - 2/r, now can you you please check?? I'm using 12.0 version, 'I am getting indeterminate form. and \mu =1, M=1.
– MMS
Dec 24, 2020 at 18:36