Behavior of Solve with $Assumptions changed in 12.2
I think this is (seen by WRI as) an improvement, and the change is marked in the docs for Solve
(noted in the comments). In the docs, it is also indicated how Assumptions
are used:
So really, it just amounts to some syntactic sugar.
On V12.0 and V12.1,
Solve[n == n E^(r (1 - n)) && n >= 0, {n}]
gives a set of three solutions equivalent to the V12.2 result in the OP with $Assumptions = {n >= 0}
. In V12.0, the second solution of the three is simply {n -> 1}
, but Simplify@Solve[...]
makes the results in all three versions identical.
In short, the new use of $Assumptions
/Assumptions
does not seem to represent any major change in how solutions are computed. I suppose what is more worrying is that code that uses $Assumptions
and Solve
and further assumes Solve
does not use $Assumptions
might break. Might have to write Block[{$Assumptions = True}, Solve[...]]
around all my instances of Solve
now.
FWIW, the fact that Solve
did not accept Assumptions
was a common complaint. To paraphrase a famous U.S. president, you can't please all of the people all of the time...
Over time, we have added Assumptions
as a option to more and more functions. E.g, DSolve
didn't used to have it, but now it does (for several versions). One of the risks of using $Assumptions
instead of passing it in manually is precisely that some function may unexpectedly change in behavior. That is one reason I prefer to passing assumptions to each call except in certain very targeted contexts. YMMV.