Here is a bit of code that gives the solution closer to the form we would prefer.
ClearAll["Global`*"]
$Version
simplify = First[Simplify[#, C[1] ∈ Integers]] &;
eqns = -a r Cos[ϕ] == R Cos[ψ] && r Sin[ϕ] == R Sin[ψ];
soln = Solve[eqns, {ψ, R}];
prefer = {R -> Sqrt[R^2 /. soln // simplify],
ψ -> ArcTan[Tan[ψ] /. soln // simplify]}
In Wolfram Cloud the code evaluated to
Sometimes we must give Mathematica some guidance. What worked this time to get closer to the preferred form was to simplify $R^2$ and $\tan(\psi)$ then use the Sqrt
and the ArcTan
to create the desired solution form.
In this case I defined a simplify
function that provides an assumption (C[1] ∈ Integers
) to the plain Simplify
and then returns only the First
expression in the list returned by Simplify
.
Edits in response to comment:
To verify the hand calc for $R$:
If we only want to verify that our hand calc is correct, we will look at soln
and think maybe something is wrong. But since we are confident in both the hand calc and soln
we will try to manipulate soln
. One manipulation is to look at $R^2$ by evaluating R^2 /. soln
. We see that MMA did not multiply it out, so we apply Simplify
. We find that Simplify[R^2 /. soln]
gives us the some expression as our hand calc, so we're done!
To verify the hand calc for $\psi$:
Similarly for $\psi$ we want to manipulate the MMA soln
to obtain something we can compare to our hand calc. soln
contains ArcTan
, so we use Tan
to get a simpler expression. We evaluate Tan[ ψ /. soln]
and find that it requires further simplification, so we next evaluate Simplify[ Tan[ ψ /. soln] ]
. The result matches our hand calc for $\tan \psi$, so we're through.
Explanation of prefer
:
Solve
gives us the solution(s) as a list of rules that we use with ReplaceAll
, the /.
operator in further calculation. The variable prefer
is a new set of rules, similar to soln
, but in the preferred form. prefer
is defined by using same manipulations we used to verify the hand calculation. That is, we start with R^2 /. soln
, then simplify and take the square root to get an expression for $R$. prefer
could be used in place of soln
in further calculation.
Explanation of simplify
:
We do the same thing for $\psi$, but soln
contains a ConditionalExpression
, which is not unusual with inverse trig functions. We can tell MMA to simplify assuming the constant is an integer, which effectively eliminates the condition.
ReplaceAll
in the docuemntation. $\endgroup$eq1 && eq1
while it should beeq1 && eq2
. $\endgroup$Solve[eq1 && eq2, {\[Psi], R}] // FullSimplify
results in{R -> -((r Sqrt[1 + a^2 + (-1 + a^2) Cos[2 \[Phi]]])/Sqrt[2]), \[Psi] -> ConditionalExpression[ArcTan[(a Cos[\[Phi]])/Sqrt[ a^2 Cos[\[Phi]]^2 + Sin[\[Phi]]^2], -(Sin[\[Phi]]/Sqrt[a^2 Cos[\[Phi]]^2 + Sin[\[Phi]]^2])] + 2 \[Pi] ConditionalExpression[1, \[Placeholder]], ConditionalExpression[1, \[Placeholder]] \[Element] Integers]}
for one solution and $\endgroup${R -> (r Sqrt[1 + a^2 + (-1 + a^2) Cos[2 \[Phi]]])/Sqrt[2], \[Psi] -> ConditionalExpression[ ArcTan[-((a Cos[\[Phi]])/Sqrt[a^2 Cos[\[Phi]]^2 + Sin[\[Phi]]^2]), Sin[\[Phi]]/Sqrt[a^2 Cos[\[Phi]]^2 + Sin[\[Phi]]^2]] + 2 \[Pi] ConditionalExpression[1, \[Placeholder]], ConditionalExpression[1, \[Placeholder]] \[Element] Integers]}
for the second solution. $\endgroup$