# How to solve numerically an equation which contains numerical integration?

    F1[x_] := NIntegrate[E^Sin[y x], {y, 0, 1}]
F2[x_] := Log[x]
NSolve[F1[x] == F2[x], x]


I want to solve the equation, but Mathematica don't solve it. What I should do?

• For one thing, DSolve is for solving differential equations. For another, an equation with a non-analytical integral is probably too hard for Solve and NSolve. Try FindRoot[..., {x, 1}]. – user484 May 13 '15 at 6:40

This can be solved via a numerical method called fixed point iteration reasonably quickly...

FixedPoint[F1[#] - F2[#] + # &, 2, 100]
(* result 4.609527035642726 takes about 0.327602 seconds on my machine *)


Let's first define F1 to take only numeric arguments because otherwise FindRoot or other functions you might use on it will try to supply some symbolic arguments to it and result in uninteresting messages:

Clear[F1]
F1[x_?NumericQ] := NIntegrate[E^Sin[y x], {y, 0, 1}]


Now plot the functions to see an expected starting point for solution search:

Plot[{F1[x], F2[x]}, {x, -3, 15}] Now we can see the solution is near 5, so let's just find the root:

FindRoot[F1[x] == F2[x], {x, 5}]
`

{x -> 4.60952703564273}