Skip to main content
1 of 2
Alex Trounev
  • 48.8k
  • 3
  • 51
  • 115

Can be used ParametricNDSolveValue

F = 1.2;
sol = ParametricNDSolveValue[{f'[
       x] (1 + 20 f[x] (1 - f[x]) f[x]^2) == -f[x], f[0] == a}, 
   f, {x, 0, 5}, {a}];
M[a_?NumericQ] := (NIntegrate[sol[a][x], {x, 0, 5}] - F)^2


sol1 = NMinimize[{M[a], 0 < a < 1}, a]
(*{1.03015*10^-21, {a -> 0.69524}}*)
Alex Trounev
  • 48.8k
  • 3
  • 51
  • 115