(* Here are two equations *)
eqns = {
az == ArcTan[Cos[lat]*Sin[dec] - Cos[dec]*Cos[gmst + lon -
ra]*Sin[lat], -(Cos[dec]*Sin[gmst + lon - ra])],
ha == gmst + lon - ra
};
(* should be easy... just replace gmst+lon-ra with ha in the az equation *)
Solve[eqns, az, {ha}] // InputForm
(* the answer, however, still contains gmst, lon, and ra *)
{{az -> ArcTan[Cos[lat]*Sin[dec] - Cos[dec]*Cos[gmst + lon - ra]*Sin[lat],
-(Cos[dec]*Sin[gmst + lon - ra])]}}
(* Eliminate won't work here ... *)
Eliminate[eqns, {gmst, lon, ra}] // InputForm
(* yielding this error *)
Eliminate::dinv:
The expression ArcTan[Cos[lat] Sin[dec] -
Cos[dec] Cos[gmst + lon - ra] Sin[lat], -(Cos[dec] Sin[gmst + lon - ra])]
involves unknowns in more than one argument, so inverse functions cannot be
used.
(* and this unhelpful output *)
az == ArcTan[Cos[lat]*Sin[dec] - Cos[dec]*Cos[gmst + lon - ra]*Sin[lat],
-(Cos[dec]*Sin[gmst + lon - ra])] && gmst == ha - lon + ra
My question here isn't necessarily "why can't Mathematica do this?" (because that answer really doesn't help me), but "what can I do to help Mathematica solve this?"
The actual problem has many more variables and equations, but this example represents the general problem.
eqns[[1]] /. Solve[eqns[[2]], gmst][[1]]
? $\endgroup$Simplify[{az == ArcTan[Cos[lat]*Sin[dec] - Cos[dec]*Cos[gmst+lon-ra]*Sin[lat], -(Cos[dec]*Sin[gmst+lon-ra])]}, {ha == gmst+lon-ra}]
will rapidly do what you are asking for, even for bigger lists and more complicated expressions, often for things where it would be very difficult forSolve
orReduce
to handle. Can you perhaps find a way to automate dividing your list of equations into two lists, the second list containing thosevar==expression
wherevar
appears at least once in the first list and doesn't appear in expression? $\endgroup$Solve
s and be done with it, but, apparently there's more to it. $\endgroup$