# Fit, NIntegrate in FindRoot results in non-numerical values

I'm trying to find certain values of q for which the derivative of the following function is equal to zero:

ρ[x_, q_] := ((x + Tanh[x/((2/Sqrt[Pi])*q)])/(1 + x))^2
αavgfluid[q_, η_] := Re[NIntegrate[D[ρ[x, q], x]*αfluid[x, η], {x, 0, Infinity}]]
αfitfluid[q_, η_] := Fit[Table[{ϕ1, αavgfluid[q, ϕ1]}, {ϕ1, 0, ηcp, 0.01}], Table[η^a, {a, 0, 10}], η]


I then for example want to find the value of q, at a given Eta at which the first derivative of this fitted function is equal to -0.3. This is where I run into problems, mathematica throws the following errors:

FindRoot[αfitfluid[q1, 0.3] == -0.3, {q1, 0.6}]
NIntegrate::inumr: The integrand 1. ((2 (1+(Sqrt[π] Sech[Times[<<4>>]]^2)/(2 q1)) (x+Tanh[(Sqrt[π] x)/(2 q1)]))/(1+x)^2-(2 (x+Tanh[1/2 Power[<<2>>] Power[<<2>>] x])^2)/(1+x)^3) has evaluated to non-numerical values for all sampling points in the region with boundaries {{∞,0.}}.
NIntegrate::inumr: The integrand E^(-0.0100503-0.030303 x-0.0307622 x^2-0.0104102 x^3) ((2 (1+(Sqrt[π] Sech[Times[<<4>>]]^2)/(2 q1)) (x+Tanh[(Sqrt[π] x)/(2 q1)]))/(1+x)^2-(2 (x+Tanh[1/2 Power[<<2>>] Power[<<2>>] x])^2)/(1+x)^3) has evaluated to non-numerical values for all sampling points in the region with boundaries {{1.,0.}}.
NIntegrate::inumr: The integrand E^(-0.0202027-0.0612245 x-0.0630987 x^2-0.021683 x^3) ((2 (1+(Sqrt[π] Sech[Times[<<4>>]]^2)/(2 q1)) (x+Tanh[(Sqrt[π] x)/(2 q1)]))/(1+x)^2-(2 (x+Tanh[1/2 Power[<<2>>] Power[<<2>>] x])^2)/(1+x)^3) has evaluated to non-numerical values for all sampling points in the region with boundaries {{1.,0.}}.
General::ivar: 0.3 is not a valid variable.
FindRoot::nlnum: The function value {0.3 +Fit[{{0.,1.},{0.01,0.959291},{0.02,0.920288},{0.03,0.882853},{0.04,0.846874},{0.05,0.812263},{0.06,0.778941},{0.07,0.746844},{0.08,0.715914},{0.09,0.686098},{0.1,0.657351},{0.11,0.629629},<<27>>,{0.39,0.157332},{0.4,0.148406},{0.41,0.139872},{0.42,0.131717},{0.43,0.123929},{0.44,0.116495},{0.45,0.109404},{0.46,0.102644},{0.47,0.0962042},{0.48,0.0900739},{0.49,0.0842421},<<25>>},{1.,<<9>>,<<22>>},0.3]} is not a list of numbers with dimensions {1} at {q1} = {0.6}.


Any help on how to fix this? I've tried making a table for various values of q and then fitting a 2D function but this reduced the sensitivity too much and gave non-physical answers. Thanks in advance! :)

• What is \[Alpha]fluid[x, \[Eta]] and \[Eta]cp`? – Cesareo Feb 12 at 10:48
• [Eta]cp is a numerical value equal to approximately 0.74 and [Alpha]fluid[x, [Eta]] is a regularly defined function of x and [Eta] – M M Feb 12 at 12:56