If I use FindRoot of this function at zero, It does not find the crossing at 13 micron (as in the figure) but at 9.2 micron, which has a value close to zero.
Why isn’t there an Intersection algorithm for functions in Mathematica?
NSolve is too slow and accuracygoal and precisiongoal does not help.
Is there a way to get the intersection value with the zero line (zero crossing)??
You might want to try the RootSearch package from Ted Ersek from the Wolfram Library Archive. I’m not certain if it still works in Version 10, but it was very good at finding roots of single parameter functions.
Here is an example of Ted Ersek’s RootSearch package that you can get from the Wolfram Library Archive. I did slightly modify his package so it’s in an Ersek folder in my Applications folder. And I think I may have added several Quiet statements.
Ted’s code will find all the roots within a specified range of the parameter. It even finds roots where the function just touches zero but doesn’t cross it. Mathematica has many ways of finding roots, some of them based of algebraic methods or Solve or Reduce. But it lacks a simple 1-dimensional numerical search. Ted’s program is very good at that.
Yes but Ted’s RootSearch algorithm, based on the literature, is much more than a bare Newton’s method. It finds all of the roots within a search range and it doesn’t get thrown off if a Newton iteration is outside the search range. And it is simple to use.
In[24]:= FindRoot[Ftot[x, 0, 5 10^(-6)] + k0*(x - 7.53 10^(-6)) == 0, {x, 0},
WorkingPrecision -> 2 $MachinePrecision]
During evaluation of In[24]:= FindRoot::precw: The precision of the argument function (<<1>>==0) is less than WorkingPrecision (31.909179540382006`). >>
Out[24]= {x -> 0.000012988020154476412351028027555890}
In[25]:= $MachinePrecision
Out[25]= 15.9546
working in the nanometer range it is clear that usual WorkingPrecision is not enough (Frank Kampas intended to point that out with his post). Quite often Mathematica built-in functions work far better than their absent-minded usage seems to suggest.
The FindRoot::precw message can be avoided if the constants are given with the precision needed, with other words