ToRules
is useful here.
If we manually set a value to the parameter C[1]
, we can convert the remaining expression to a list of rules similar to what Solve
would return:
In[5]:= rules = {ToRules[sol /. C[1] -> 0]}
Out[5]= {{phi -> -ArcCos[-(Csc[theta]/Sqrt[3])]}, {phi -> ArcCos[-(Csc[theta]/Sqrt[3])]},
{phi -> -ArcCos[Csc[theta]/Sqrt[3]]}, {phi -> ArcCos[Csc[theta]/Sqrt[3]]}}
Notice that ToRules
removed the Sin[theta] != 0
condition, but it would remove the C[1] ∈ Integers
condition if we don't make it go away manually. I do not know (and did not check) when precisely it will remove any conditions. So in more general applications this is something to pay attention to.
Plot[phi /. rules, {theta, -5, 5}]
An alternative approach here is to use Solve
, which returns the same solution (in recent versions!) as Reduce
, but in a different form:
Solve[a == 0, phi]
(* {{phi ->
ConditionalExpression[-ArcCos[-(Csc[theta]/Sqrt[3])] +
2 π C[1], C[1] ∈ Integers]}, {phi ->
ConditionalExpression[ArcCos[-(Csc[theta]/Sqrt[3])] + 2 π C[1],
C[1] ∈ Integers]}, {phi ->
ConditionalExpression[-ArcCos[Csc[theta]/Sqrt[3]] + 2 π C[1],
C[1] ∈ Integers]}, {phi ->
ConditionalExpression[ArcCos[Csc[theta]/Sqrt[3]] + 2 π C[1],
C[1] ∈ Integers]}} *)
If Solve
does not generate full conditions by default, as Reduce
would, we can use the option Solve[..., Method -> Reduce]
to force it to do so.
To make all these ConditionalExpression
s go away, we can use Normal
:
sol2 = Normal@Solve[a == 0, phi]
(* {{phi -> -ArcCos[-(Csc[theta]/Sqrt[3])] +
2 π C[1]}, {phi ->
ArcCos[-(Csc[theta]/Sqrt[3])] +
2 π C[1]}, {phi -> -ArcCos[Csc[theta]/Sqrt[3]] +
2 π C[1]}, {phi -> ArcCos[Csc[theta]/Sqrt[3]] + 2 π C[1]}} *)
Notice that this retained C[1]
, but dropped the condition. Now we can do
Block[{C}, Join @@ Table[phi /. sol2, {C[1], -5, 5}]]
to have a table of solutions corresponding to $C_1 \in \{-5, -4, \ldots, 4, 5\}$. Block
was needed to temporarily lift the protection from C
.
Using Solve
doesn't give anything new here, it's just a different way of achieving the same results. It may be more or less convenient than Reduce
.
{ToRules[sol /. C[1] -> 0]}
acceptable here? The manual step was choosing a particular (integer) value forC[1]
. $\endgroup$Table
? Can't really think of anything simpler than that. $\endgroup$