Find equation that represents $m$ as the subject $$P_b=m(x\bar{x})+ m\left(\frac{my ̅\bar{y}(m+1)}2\right)- m\left(\frac x{f_x} + \frac y{f_y} \right)S - M$$
I am a novice at maths, but me and a friend came up with a formula for a hobby of ours, and as I couldn't find any tags that I really understood would fit this question, I have listed it only as homework. If you can think of more relevant tags, please help me with that.
What we are trying to do is rearrange this equation so that the subject of the equation is $m$. This is a challenge considering the equation; our current workings led us to:
$$2(P_b - M)= m\left(2x\bar{x} + 2m^2y\bar{y} + my\bar{y} - \frac{2Sx}{f_x} - \frac{2Sy}{f_y}\right)$$
But we're stuck and can't get any further than that because of the appearance of $m^x, x > 1$. Could anybody help us to make $m$ the subject of this behemoth? 
Thank you!
 A: Can you rewrite it as $(\mathrm{something})m^3 + (\mathrm{something})m^2 + (\mathrm{something})m + (\mathrm{something}) = 0$? If so, you can follow one of the many methods listed here, such as the general cubic formula - but beware, it's not pretty.
A: Using Mathematica, I solved the cubic to get the following solution:
$$ \frac{\sqrt[3]{-216 f_x^3 f_y^3 M y^2 \bar{y}^2+216 f_x^3 f_y^3 P_b y^2 \bar{y}^2+36 f_x^3 f_y^3 x \bar{x} y^2 \bar{y}^2-2 f_x^3 f_y^3 y^3 \bar{y}^3-36 f_x^3 f_y^2 Sy y^2 \bar{y}^2-36 f_x^2 f_y^3 Sx y^2 \bar{y}^2+\sqrt{4 \left(-f_x^2 f_y^2 y^2 \bar{y}^2-12 f_x f_y y \bar{y} (-f_x f_y x \bar{x}+f_x Sy+f_y Sx)\right)^3+\left(-216 f_x^3 f_y^3 M y^2 \bar{y}^2+216 f_x^3 f_y^3 P_b y^2 \bar{y}^2+36 f_x^3 f_y^3 x \bar{x} y^2 \bar{y}^2-2 f_x^3 f_y^3 y^3 \bar{y}^3-36 f_x^3 f_y^2 Sy y^2 \bar{y}^2-36 f_x^2 f_y^3 Sx y^2 \bar{y}^2\right)^2}}}{6 \sqrt[3]{2} f_x f_y y \bar{y}}-\frac{-f_x^2 f_y^2 y^2 \bar{y}^2-12 f_x f_y y \bar{y} (-f_x f_y x \bar{x}+f_x Sy+f_y Sx)}{3\ 2^{2/3} f_x f_y y \bar{y} \sqrt[3]{-216 f_x^3 f_y^3 M y^2 \bar{y}^2+216 f_x^3 f_y^3 P_b y^2 \bar{y}^2+36 f_x^3 f_y^3 x \bar{x} y^2 \bar{y}^2-2 f_x^3 f_y^3 y^3 \bar{y}^3-36 f_x^3 f_y^2 Sy y^2 \bar{y}^2-36 f_x^2 f_y^3 Sx y^2 \bar{y}^2+\sqrt{4 \left(-f_x^2 f_y^2 y^2 \bar{y}^2-12 f_x f_y y \bar{y} (-f_x f_y x \bar{x}+f_x Sy+f_y Sx)\right)^3+\left(-216 f_x^3 f_y^3 M y^2 \bar{y}^2+216 f_x^3 f_y^3 P_b y^2 \bar{y}^2+36 f_x^3 f_y^3 x \bar{x} y^2 \bar{y}^2-2 f_x^3 f_y^3 y^3 \bar{y}^3-36 f_x^3 f_y^2 Sy y^2 \bar{y}^2-36 f_x^2 f_y^3 Sx y^2 \bar{y}^2\right)^2}}}-\frac{1}{6} $$
You're welcome! I suspect however, that this isn't what you had in mind!
A better way to do this would be numerical approximation. Compute the derivative of your function with respect to $m$, which is:
$$ g'(m) = -\frac{2 S_x}{f_x}-\frac{2 S_y}{f_y}+2 m^2 y \bar{y}+m y \bar{y}+m (4 m y \bar{y}+y \bar{y})+2 x \bar{x} $$
Now, choose some value $m_0$ and recursively compute:
$$ m_{n+1} = m_n - \frac{g(m)}{g'(m)} $$
The longer you do this process, the closer to the value of $m$ you'll get.
