Q:

(error) FindRoot limits of integration

I have a function u[y] and I want to find the limit of integration that integration is equal zero.
Λ = -30;
u[η_] := (2*η - 2*η^3 + η^4) + Λ/6*(η - 3*η^2 + 3*η^3 - η^4);
θ = Integrate[u[η]*(1 - u[η]), {, 0, 1}] // N;
δ = 1/θ;
u[y_] := Piecewise[{{1,y > δ}}, (2*y/δ - 2*(y/δ)^3 + (y/δ)^4) + Λ/6*
((y/δ) - 3*(y/δ)^2 + 3*(y/δ)^3 - (y/δ)^4)];

FindRoot[Integrate[u[y], {y, 0, yd}] , {yd, 5}]

I have the following error:
"Unable to prove that integration limits {0,yd} are real. Adding assumptions may help."

A:

the integral can be done for symbolic yd , so you should do that once before using FindRoot.
\[CapitalLambda] = -30;
u[\[Eta]_] := (2*\[Eta] - 2*\[Eta]^3 + \[Eta]^4) + \[CapitalLambda]/
     6*(\[Eta] - 3*\[Eta]^2 + 3*\[Eta]^3 - \[Eta]^4);
\[Theta] = Integrate[u[\[Eta]]*(1 - u[\[Eta]]), {\[Eta], 0, 1}]
\[Delta] = 1/\[Theta];
u[y_] := Piecewise[{{1, 
     y > \[Delta]}}, (2*y/\[Delta] - 
      2*(y/\[Delta])^3 + (y/\[Delta])^4) + \[CapitalLambda]/
      6*((y/\[Delta]) - 3*(y/\[Delta])^2 + 
       3*(y/\[Delta])^3 - (y/\[Delta])^4)];
f[yd_] = Integrate[u[y], {y, 0, yd}, Assumptions -> yd > 0]
FindRoot[f[x], {x, 10}]

( note not-delayed = for f )

x -> 9.01341

NSolve[f[x], x] works too:

{{x -> 0}, {x -> 9.01341}}

