7
$\begingroup$

Is the solution set returned by NSolve usually complete? Can I assume that there are no more solutions than what it returns? Consider systems of equations e.g. like this one.

I expect that the answer is either generally "no" or that it depends on the type of equations (polynomial? exact coefficients?), on the method being used, and on other settings (such as VerifySolutions). So the better question is: in which cases (if any) can I assume that NSolve found all solutions?

It is clear that the solution values are approximate but it is not clear that the number of solutions is also approximate. Multiple roots are generally returned with the correct multiplicity.

$\endgroup$
10
  • 3
    $\begingroup$ Here's a relatively innocuous case where it fails: NSolve[Product[1.1^n x - 1., {n, 20}] == 0 && 0 < x < 1, x] // Length. I don't know how to predict that it would fail.... $\endgroup$
    – Michael E2
    Commented Oct 26, 2016 at 10:48
  • $\begingroup$ @MichaelE2 Not only NSolve, but also Solve fails for this. It's strange that after removing the constraint of 0 < x < 1 it works. With exact coefficients it also works. $\endgroup$
    – Szabolcs
    Commented Oct 26, 2016 at 11:12
  • $\begingroup$ @MichaelE2 NRoots also works with all three documented methods. Maybe the constraint triggers a switch to a different method? Somehow this really feels like a bug but then I am not familiar with the numerical intricacies of finding polynomial roots and the coefficients do span 10 orders of magnitude. $\endgroup$
    – Szabolcs
    Commented Oct 26, 2016 at 11:15
  • 2
    $\begingroup$ @user64494 There are internal constraints that limit the number of solutions found. This gets them all: SetSystemOptions["ReduceOptions" -> {"IntervalRootsOptions" -> {"MaxIncomplete" -> 35000, "MaxSteps" -> 150000}}]; NSolve[Sin[1/(x + 10^(-5))] == 0 && x > 0 && x < 1, x] // Length. $\endgroup$
    – Michael E2
    Commented Oct 26, 2016 at 12:33
  • 1
    $\begingroup$ @user64494 My point is simply that there are such limits that are programmed and not numerical limitations of the algorithms. However, when you get exactly 1000 solutions, you might wonder if you hit the limit and try increasing it. The other limits are harder to detect. It does not appear there is a way to get NSolve to tell you when it's run into such a limit, which is too bad. -- A site tip: if you don't put a space between the @ and my name, I'll get notified of your reply. $\endgroup$
    – Michael E2
    Commented Oct 26, 2016 at 12:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.