# Plot after applying NIntegrate

I'm trying to integrate and graph $$I$$ vs $$b$$ the following integral (eq. 24 in this paper) in wolfram mathematica

$$I = \int_{2}^{\infty} \frac{g_i^3 \mathcal{K}_t \mathrm{~d} r}{r^2\left|\mathcal{K}_r\right|}$$

where

$$g_i=\left(u_e^t+\left(\frac{\mathcal{K}_r}{\mathcal{K}_t}\right) u_e^r\right)^{-1}$$ $$\mathcal{K}_t=\frac{1}{b}, \quad \frac{\mathcal{K}_r}{\mathcal{K}_t}= \pm \sqrt{B(r)\left(\frac{1}{A(r)}-\frac{b^2}{r^2}\right)}$$

M = 1;
A[r_] := 1 - (2 M r^2)/(g^2 + r^2)^(3/2);
B[r_] := 1/A[r];
uet = 1/A[r];
uer = -Sqrt[((1 - A[r])/(A[r] B[r]))];
kt = 1/b;
kr = kt Sqrt[B[r] (1/A[r] - b^2/r^2)];
Assuming[{(1/A[r]) (1/A[r] - b^2/r^2) > 0}, Simplify[kr]];
gi = (uet + (kr/kt) uer)^-1;
in = ((gi^3 kt)/(r^2 Abs[kr])) // Simplify
Int[b_?NumericQ, g_?NumericQ] :=
NIntegrate[1/(
b r^2 (1/(1 - (2 r^2)/(g^2 + r^2)^(3/2)) -
Sqrt[2] Sqrt[r^2/(g^2 + r^2)^(3/2)] Sqrt[(
1 + b^2 (-(1/r^2) + 2/(g^2 + r^2)^(3/2)))/(1 - (
2 r^2)/(g^2 + r^2)^(3/2))^2])^3 Abs[Sqrt[(
1 + b^2 (-(1/r^2) + 2/(g^2 + r^2)^(3/2)))/(1 - (
2 r^2)/(g^2 + r^2)^(3/2))^2]/b]), {r, 2, 100},
Method -> "LocalAdaptive", AccuracyGoal -> 5,
PrecisionGoal -> 4] // Quiet;
g0 = {0, .475, .75}; Plot[
Evaluate[Int[b, #] & /@ g0 // Re], {b, 0, 20},
PlotStyle -> {Black, Green, Red},
AxesLabel -> {"b", "\!$$\*SubscriptBox[\(I$$, $$obs$$]\)"},
PlotRange -> {0, 1.2}, PlotPoints -> 10]


but what I get is the following graph

By increasing the PlotPoints it only takes a while but I don't get the graph I'm looking for:

int is producing seemingly random numbers because AccuracyGoal -> 5, PrecisionGoal -> 4 are too small. Increasing the values to 8 gives with no other changes.
• Thanks for the observation! Actually, it is assumed that performing the integration and graphing $I$ vs $b$ should be enough to obtain the last graph that I indicated in the question Nov 8, 2023 at 7:14
• In that case, I recommend that you go through your code line by line to verify that it accurately represents the equations you are trying to solve. I did notice that gi is computed but not used. Is that your intent? Nov 8, 2023 at 13:27
• You're right. Actually I missed adding the Int line that when executed gives me the Int argument Nov 8, 2023 at 13:45
• Where do you use in after defining it? Nov 8, 2023 at 14:26
• When I run  in I get:  1/( b r^2 (1/(1 - (2 r^2)/(g^2 + r^2)^(3/2)) - Sqrt[2] Sqrt[r^2/(g^2 + r^2)^(3/2)] Sqrt[( 1 + b^2 (-(1/r^2) + 2/(g^2 + r^2)^(3/2)))/(1 - ( 2 r^2)/(g^2 + r^2)^(3/2))^2])^3 Abs[Sqrt[( 1 + b^2 (-(1/r^2) + 2/(g^2 + r^2)^(3/2)))/(1 - ( 2 r^2)/(g^2 + r^2)^(3/2))^2]/b]) I put it in the Int argument Nov 8, 2023 at 15:24