My function is
(* condição para o valor de b0 *)
σ = 0.6 ;
minroot[g_?NumericQ, b_?NumericQ] :=
Module[{rts, r},
rts = r /.
Solve[1 - (b/r)^2 -
g^-2*(2/15*σ^9 (1/(r - 1)^9 - 1/(r + 1)^9 -
9/(8 r) (1/(r - 1)^8 -
1/(r + 1)^8)) - σ^3 (1/(r - 1)^3 -
1/(r + 1)^3 - 3/(2 r) (1/(r - 1)^2 - 1/(r + 1)^2))) ==
0, r];
rts = Select[rts, With[{nval = N[#, 100]}, Im[nval] == 0 && nval > 0] &];
Max[rts]];
rootmin[g_?NumberQ] :=
Module[{Rrmts, b},
Rrmts = b /.
FindRoot[Re[aA[g, b, 5]] == 0, {b, 1, 2}, Method -> "Brent"];
Rrmts];
(* angulo de espalhamento *)
aA[g_?NumberQ, b_?NumberQ, i_] :=
Pi - 2 b NIntegrate[
1/(r^2*Sqrt[
1 - (b/r)^2 -
g^-2*(2/15*σ^9 (1/(r - 1)^9 - 1/(r + 1)^9 -
9/(8 r) (1/(r - 1)^8 -
1/(r + 1)^8)) - σ^3 (1/(r - 1)^3 -
1/(r + 1)^3 -
3/(2 r) (1/(r - 1)^2 - 1/(r + 1)^2)))]), {r,
minroot[g, b], Infinity},
Exclusions -> {r^2*
Sqrt[1 - (b/r)^2 -
g^-2*(2/
15*σ^9 (1/(r - 1)^9 - 1/(r + 1)^9 -
9/(8 r) (1/(r - 1)^8 -
1/(r + 1)^8)) - σ^3 (1/(r - 1)^3 -
1/(r + 1)^3 -
3/(2 r) (1/(r - 1)^2 - 1/(r + 1)^2)))] == 0},
MaxRecursion -> i,
Method -> {Automatic, "SymbolicProcessing" -> 0}];
When I evaluate
rootmin[0.3]
I get
Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.
but when I evaluate
rootmin[0.4]
1.95804
I still get some errors, but I get a result.
Why? I want to evaluate rootmin[0.1]
, for example, and I can't.
NIntegrate::inumr
,FindRoot::nlnum
etc. Also, in the definitionaA
, you useminroot[g,b]
; Is it the same asrootmin[g,b]
? $\endgroup$minroot
. $\endgroup$minroot
, it is pretty clear what your problem is, and I have an answer I would like to post. $\endgroup$