# Solving a nonlinear equation for one of variables with the help of a computer algebra system

Are there any solutions out there that can take a wide variety of equations with variables, like the one below, and transpose or isolate variables to other sides of the equation automatically?

For example, imagine having to transpose the variable "g" (gravity) to be by itself on the left of the equation, I'm just looking for a program or online tool to do this automatically.

Perhaps Wolfram Alpha or Mathematica can do this?

Note to SE people: I tried to use the tag "transposition" but it wasn't available, couldn't think of any other tags. UPDATE: It appears that Wolfram Alpha has a Solve command for this (thanks Lord_Farin), even though many math books, math teachers, and math websites refer to this practice as "changing the subject of a formula" and "transposing" it seems to be the same thing as "solving for a variable."

The only issue now is that Wolfram Alpha gives funky results, for example if you punch in this: original equation you get a very odd answer from Wolfram Alpha. If you change the x2-x1 and y2-y1 stuff to just "x" and "y" (I tried using delta symbol to represent "change in x or y" but it was still a weird answer) you get a clean answer like this. Does anyone know why this happens or how to better write equations for Wolfram Alpha?

• You mean to solve for $g$? Mathematica has the Solve command for this. – Lord_Farin Apr 13 '13 at 10:29
• reference.wolfram.com/mathematica/ref/Transpose.html this link is about transposition in wolfram but I though it's nothing like you want. – Lrrr Apr 13 '13 at 10:34
• I've responded to you in an edit of my original post, Lord_Farin, thank you – Luke Allen Apr 13 '13 at 10:52
• There's nothing odd in that result, it's equivalent. You'd just need to simplify it (Simplify or FullSimplify in Mathematica) – Ruslan Apr 13 '13 at 11:38

var('v0, g, x1, x2, y1, y2, theta')

That's it. Actually, I put latex() around the solve command to get a code I could copy-paste here:
$$g = -\frac{2 \, {\left(v_{0}^{2} y_{1} \cos\left(\theta\right)^{2} - v_{0}^{2} y_{2} \cos\left(\theta\right)^{2} + v_{0}^{2} x_{1} \tan\left(\theta\right) - v_{0}^{2} x_{2} \tan\left(\theta\right)\right)}}{x_{1}^{2} - 2 \, x_{1} x_{2} + x_{2}^{2}}$$