# What's the difference between plotting and solving?

Posted 4 years ago
4233 Views
|
6 Replies
|
5 Total Likes
|
 Hello community,this is something that's been bugging me for a long time, I simply don't get it: Why can Mathematica plot some functions without any problem, but not numerically solve an equation containing this function? I mean, I can see that Mathematica obviously calculated the values for plotting. Now why can't NSolve just use these values, compare them to the value I want to solve for (e.g., 0) and then tell me for which x the function f(x) is closest to 0? I had to build my own functions doing exactly that, and that's cumbersome and very prone to errors since I'm not a programmer.Any insight provided to me about this issue is appreciated!
6 Replies
Sort By:
Posted 4 years ago
 Sebastian,Nsolve always works for me. Please give an example of code that has an issue so we can see how you are using it. Regards
Posted 4 years ago
 As already noted, it is difficult to respond to a question like this in absence of code for an example. Taking a guess I would surmise that no restriction was given to NSolve for where the solutions(s) might be located (Reals, an interval of the form a<=x<=b, etc.) and if the unrestricted solution set is perhaps infinite it cannot give a result.
Posted 4 years ago
 Ted Ersek's package RootSearch fills in quite nicely for the missing built-in functionality.
Posted 4 years ago
 In this Stackexchange answer, Adam Strzebonski showed a way to get complex roots from SystemTRootsDumpGuessRoots[f, {a, b}, False], where f is a pure function. For real roots one can use SystemTRootsDumpGuessRealRoots[f, {a, b}]. These use ContourPlot and Plot respectively to approximate the roots. The results can be polished with FindRoot. It's not clear to me how they plug into the high-level solvers.