I was given the following problem:
Consider the equation x = exp(-x2). Plot the two curves on the same plot to get a rough idea of the intersection point. Then use a built - in function (e.g. FindRoot or FixedPoint or Solve) to find the solution to 100 significant digits and use the option "EvaluationMonitor" to find out how many iterations Mathematica took.
I was able to solve it except for the number of iterations it took to fiu=.
- Why isn't it giving me the number of iterations it took to solve it?
How do I fix it?
In[42]:= f = x
g = Exp[-x^2]
Block[{c = 0}, {FindRoot[f == g, {x, 0, 1}, WorkingPrecision -> 100,
EvaluationMonitor -> c++], c}]
Out[42]= x
Out[43]= E^-x^2
Out[44]= {{x ->
0.65291864041920471553508076735319636992011688110299773062492149407\
50472761980389255118225716068055969}, 1}