I have the following error at FindRoot
using a function with NIntegrate
:
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in y near {y} = {10.9130359139484499045371956829929066187800934528695506742224097252}. NIntegrate obtained 2.2676305277968822`*^-14 and 9.641852330564264`*^-13 for the integral and error estimates.
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in y near {y} = {10.9130359139484499045371956829929066187800934528695506742224097252}. NIntegrate obtained 2.2676305277968822`*^-14 and 9.641852330564264`*^-13 for the integral and error estimates.
NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in y near {y} = {10.1455}. NIntegrate obtained -3.85109*10^-16 and 1.5965726624074823`*^-16 for the integral and error estimates.
General::stop: Further output of NIntegrate::ncvb will be suppressed during this calculation.
My code:
b = -35/100;
d = 9;
u[y_] := (Tanh[a*(y - d)] + Tanh[a*d])/(1 + Tanh[a*d]) +
b*Sqrt[3]*y/d*Exp[-1.5*(y/d)^2 + 0.5];
f[a_?NumericQ] := NIntegrate[u[y] (1 - u[y]), {y, 0, 80}];
a = Rationalize[FindRoot[f[a] == 1, {a, 14/100}][[1, 2]], 0];
g[ydd_?NumericQ] := NIntegrate[u[y], {y, 0, ydd}];
FindRoot[g[ydd], {ydd, 10}]
What is wrong?