I am also using Windows 10 and Mathematica 12.3.1. And I can not reproduce the issue. No matter how many times PlanarAngle[{0,1} -> {{-Sin ... is evaluated the output always contains Conjugate
After testing a bit more on another W10 computer I must correct myself. There the change from complex to real also appears, but later than it does on the Cloud. Typically around the 14th evaluation.
Very very strange. Does anybody have any idea what happens here?
I think repeatability and reproducibility shoul be one of the most basic features of programming languages. PlanarAngle seems to show a kind of randomness instead.
This is clearly a bug and should be reported here. To work around the issue until it is fixed, I recommend calling ClearSystemCache[] before PlanarAngle.
@Jason: This makes results at least reproducible, just like Remove, ClearAll do (see above). But it is a very expensive operation since it clears all cached intermediate results so far.
@Hans: Yes, VectorAngle[u,v] remains stable. But VectorAngle is very different from PlanarAngle since it does not honor the direction of rotation. It gives the smaller of the two angles between u and v. Hence it is useless for calculating rotation angles. You must enhance it with quite complicated case diffentiations according to the relative positions of p, q1, q2. This is why PlanarAngle exists. See:
Meanwhile I found out that the symbolic result of PlanarAngle is wrong. The correct symbolic result of PlanarAngle would have to be a Piecewise expression that depends on the relative positions of the points p, q1, q2.
See the following and attached Notebook “210717b PlanarAngle Issues 2.nb”.