Summary: given a formula(s) that shows a relation between several variables, how to make Mathematica find all relations between these variables.

raDecLatLonGMST2azAlt[ra_, dec_, lat_, lon_, gmst_] = 
 {ArcTan[Cos[lat]*Sin[dec] - Cos[dec]*Cos[gmst + lon - ra]*Sin[lat], 
  -(Cos[dec]*Sin[gmst + lon - ra])], 
 ArcTan[Sqrt[(Cos[lat]*Sin[dec] - Cos[dec]*Cos[gmst + lon - ra]*Sin[lat])^2 + 
    Cos[dec]^2*Sin[gmst + lon - ra]^2], 
  Cos[dec]*Cos[lat]*Cos[gmst + lon - ra] + Sin[dec]*Sin[lat]]}

The function above takes 5 inputs (ra, dec, lat, lon, and gmst) and yields two outputs. The outputs aren't formally named, but I refer to them as az and alt, in that order.

Symbolically, this could be considered a formula taking:

{ra, dec, lat, lon, gmst} -> {az,alt}

or, since az and alt are independent, as two separate formulas (which might be easier to deal with):

{ra, dec, lat, lon, gmst} -> az
{ra, dec, lat, lon, gmst} -> alt

Of course, there are several other relationships between the 7 variables (ra, dec, lat, lon, gmst, az, and alt). For example:

  • given {ra, dec, lat, lon, alt}, it's possible to find gmst

  • given {dec, lat, alt}, it's possible to find az (there are actually two values, more if you allow for periodicity)

My question: how can I have Mathematica give me all possible formulas that take a subset of these values as input and yield a subset of these values as output?

I can do this manually to some extent using Solve, but the combinations are tedious, and I was hoping there was an automatic method.

Note the example formulas given is from astronomy, but my question is generic to any multi-variable formula.

  • 1
    $\begingroup$ Perhaps you could automate the search by running Solve with appropriately chosen variables to solve for / to eliminate. Maybe start from the Subsets of your set of variables? $\endgroup$ – MarcoB May 3 '18 at 21:00

Your equation is very complicated... here's a simple example of what you are asking for -- a function of 3 variables is to be solved in turn for each of the variables:

f[x_, y_, z_] := x - y^2 + Sqrt[z];
Solve[f[x, y, z] == 0, #] & /@ {x, y, z}

{{{x -> y^2 - Sqrt[z]}}, 
{{y -> -Sqrt[x + Sqrt[z]]}, {y -> Sqrt[x + Sqrt[z]]}}, 
{{z -> x^2 - 2 x y^2 + y^4}}}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.