N[Solve] NSolve

I am getting different results everytime I use these commands.

  • 6
    $\begingroup$ I get the same results with N[Solve[x == 1]] and NSolve[x == 1]. Ditto for the equation x^2 == 1. Hmm, I'm always getting the same results. Maybe you should post an example. They aren't equivalent, I know that. But your question is too broad and general as it stands. $\endgroup$ – Michael E2 Oct 23 '20 at 2:56
  • $\begingroup$ @MichaelE2: Here is an example: the outputs of NSolve[x^2 == y, {x, y}] and N[Solve[x^2==y,{x,y}]] differ. $\endgroup$ – user64494 Oct 23 '20 at 5:34
  • 1
    $\begingroup$ NSolve calculates a result numerically using machine (inexact) numbers . On the other hand, N[Solve[...]] solves first the equation symbolically or with exact numbers if the the input contains exact numbers and no machine numbers. Only after having calculated a result, the result is evaluated with machine numbers. Even in the case that you feed Solve machine numbers and the system is badly conditioned, Solve is smart enough to realize this and changes your input to rational numbers for further calculations. $\endgroup$ – Daniel Huber Oct 23 '20 at 8:32
  • $\begingroup$ @user64494 How do you know that's what the OP has in mind? As I said, I know there are differences. If your sort of example, which is explained in the docs, is not what the OP has in mind, it is not helpful. $\endgroup$ – Michael E2 Oct 23 '20 at 12:55