# How to remove an "Indeterminate" term from numerical evaluation

Please, I have written the following code and the 3D-plot can't be displayed when the value of the parameter p=1, because from the Table produce, there is an Indeterminate expression that appears. This is certainly due to the first logarithmic term in the expression of function F, which is (1 - p) Log[(1 - p)/ 9]. Please, i need help to solve that issue so as to produce the plot for the value p=1. Thanks to all.

ClearAll[Nf]
F = 2 (1 - p) Log[(1 - p)/9] + (2 + 7 p - 3 Sqrt[(1 + 8 G3^(2 Nf)) p^2]) Log[1/18 (2 + 7 p - 3 Sqrt[(1 + 8 G3^(2 Nf)) p^2])];
(**)
x = 10^-4; y = 10^4; n2 = 2; n3 = 3; n4 = 4; alpha = 2;
(**)
Nf = 1;
(**)
W13 = Sqrt[n3^2 - z^2];
W23 = Sqrt[z^2 - n3^2];
(**)
Pr = 1/(z Log[y/x]);
(**)
D13[T_] := Pr*Exp[(-z)*T]*(Cos[T*W13] + (z*Sin[T*W13])/W13);
D23[T_] := Pr*Exp[-z T] (Cosh[T W23] + (z*Sinh[T W23])/W23);
(**)
XX3[T_?NumericQ] := NIntegrate[D13[T], {z, x, n3}] + NIntegrate[D23[T], {z, n3, y}];
(**)
FF[T_, p_] := F /. G3 -> XX3[T];
(**)
Tstep = .1;
pstep = 0.1;
Tmax = 10;
Rstep = 2;
(**)
FFF = Table[{T, p, FF[T, p]}, {T, 0, Tmax, Tstep}, {p, 0, 1, pstep}]
ListPlot3D[Flatten[FFF, 1], Axes -> True]

• Where is Pr defined? Apr 16 '20 at 15:22
• Oops. Sorry. Let me fix it. Apr 16 '20 at 15:39
• Done. Thank you Apr 16 '20 at 16:13
• Apr 16 '20 at 17:07
• Perhaps FFF /. {___, Indeterminate, ___} :> Nothing? Apr 16 '20 at 17:08

Define F to have a special value for $$p=1$$:

F[p_] = 2 (1 - p) Log[(1 - p)/9] + (2 + 7 p -
3 Sqrt[(1 + 8 G3^(2 Nf)) p^2]) Log[
1/18 (2 + 7 p - 3 Sqrt[(1 + 8 G3^(2 Nf)) p^2])];
F[1] = Limit[F[p], p -> 1, Direction -> "FromBelow"];


Then proceed as you had it:

x = 10^-4; y = 10^4; n2 = 2; n3 = 3; n4 = 4; alpha = 2;
Nf = 1;
W13 = Sqrt[n3^2 - z^2];
W23 = Sqrt[z^2 - n3^2];
Pr = 1/(z Log[y/x]);
D13[T_] = Pr*Exp[(-z)*T]*(Cos[T*W13] + (z*Sin[T*W13])/W13);
D23[T_] = Pr*Exp[-z T] (Cosh[T W23] + (z*Sinh[T W23])/W23);
XX3[T_?NumericQ] :=
NIntegrate[D13[T], {z, x, n3}] + NIntegrate[D23[T], {z, n3, y}];


This line modified a bit:

FF[T_?NumericQ, p_] := F[p] /. G3 -> XX3[T]


The pstep is chosen rational (1/10) to make sure we hit the special case $$p=1$$ exactly:

Tstep = .1;
pstep = 1/10;
Tmax = 10;
Rstep = 2;
FFF = Table[{T, p, FF[T, p]}, {T, 0, Tmax, Tstep}, {p, 0, 1, pstep}]
ListPlot3D[Flatten[FFF, 1], Axes -> True]


• Thanks a lot. I'm having a solution to my problem from this sample. Apr 17 '20 at 21:13