<s>[INST] Fourth degree polynomial in trajectory problem I have a problem where I'm trying to find the distance needed to lead a moving target with a projectile given variable parameters. I've had limited success so far and I think I may be close to a solution but I'm not sure how to go about the final steps involving a fourth degree polynomial. I've looked into Ferrari's method and tried using Cardano's formula as well as Lagrange's resolvents but I haven't been able to come to grips with them in terms of finding the real roots. Before showing the equation I'd also like to show the method of obtaining it in case I made an error in getting to where I am in the first place. This is a diagram of the problem:

The target is moving with velocity $v_1$ and the cannon firing the projectile is initially at an angle $a_1$ and distance $d_1$ from the target. The projectile is fired at velocity $v_2$ and angle $a_2$ over a distance $d_2$ where it meets the target after a distance of $x$. The unknowns are $a_2$, $d_2$, and $x$.
The relevant equations used are $$d_2 = \frac{v_2^2sin(2a_2)}{g}$$ $$t = \frac{d_2}{v_2cos(a_2)}$$$$x = v_1t$$
from which two equations in terms of $a_2$ are derived:
$$\frac{x}{v_1} = \frac{d_2}{v_2cos(a_2)}$$
$$\frac{x}{v_1} = \frac{2\,v_2^2\,sin(a_2)cos(a_2)}{g\,v_2\,cos(a_2)}$$
$$a_2 = arcsin\left(\frac{x\,g}{2\,v_1\,v_2}\right)$$
and then with the law of cosines:
$$d_2^2 = x^2 + d_1^2 - 2\,x\,d_1cos(a_1)$$
$$\frac{v_2^2sin(2a_2)}{g} = \sqrt{x^2 + d_1^2 - 2\,x\,d_1cos(a_1)}$$
$$a_2 = \frac12arcsin\left(\frac{g}{v_2^2}\sqrt{x^2 + d_1^2 - 2\,x\,d_1cos(a_1)}\right)$$
and finally setting these two equal to solve for x:
$$arcsin\left(\frac{x\,g}{2\,v_1\,v_2}\right) = \frac12arcsin\left(\frac{g}{v_2^2}\sqrt{x^2 + d_1^2 - 2\,x\,d_1cos(a_1)}\right)$$
$$2\left(\frac{x\,g}{2\,v_1\,v_2}\right)\sqrt{1-\left(\frac{x\,g}{2\,v_1\,v_2}\right)^2} = \frac{g}{v_2^2}\sqrt{x^2 + d_1^2 - 2\,x\,d_1cos(a_1)}$$$$\frac{x^2}{v_1^2}\left(1 - \frac{x^2\,g^2}{4\,v_1^2\,v_2^2}\right) = \frac{1}{v_2^2}(x^2 + d_1^2 - 2\,x\,d_1cos(a_1))$$$$\frac{x^2\,v_2^2}{v_1^2} - \frac{x^4\,g^2}{4\,v_1^4} = x^2 + d_1^2 - 2\,x\,d_1cos(a_1)$$$$\left(\frac{g^2}{4\,v_1^4}\right)\,x^4 + \left(1-\frac{v_2^2}{v_1^2}\right)\,x^2 + \left(-2\,d_1\,cos(a_1)\right)\,x + (d_1^2) = 0$$
and this is where I get stuck. I can recognize the fourth degree polynomial but I don't know how to go about getting the real roots. Any help would be appreciated, thanks.
 [/INST] I managed to find the equation for the solution of a depressed fourth degree polynomial on WolframAlpha and it yielded the expected results:
Let $$a = \frac{g^2}{4\,v_1^4}$$ $$c = 1-\frac{v_2^2}{v_1^2}$$ $$d = -2\,d_1\,cos(a_1)$$ $$e = d_1^2$$
$$y = \sqrt[3]{\sqrt{(-72\,e\,a\,c + 27\,a\,d^2 + 2\,c^3)^2 - 4(12\,e\,a + c^2)^3} - 72\,e\,a\,c + 27\,a\,d^2 + 2\,c^3}$$
Then the first root and the one that is real when the parameters are valid:
$$x = \frac{1}{2}\sqrt{\frac{y}{3\sqrt[3]{2}\,a} + \frac{\sqrt[3]{2}\,(12\,e\,a + c^2)}{3\,a\,y} - \frac{2\,c}{3\,a}} - \frac{1}{2}\sqrt{\frac{-1}{3\sqrt[3]{2}\,a}\,y - \frac{\sqrt[3]{2}\,(12\,e\,a + c^2)}{3\,a\,y} - \frac{2\,d}{a\,\sqrt{\frac{1}{\sqrt[3]{2}\,a}\,y + \frac{\sqrt[3]{2}\,(12\,e\,a + c^2)}{3\,a\,y} - \frac{2\,c}{3\,a}}} - \frac{4\,c}{3\,a}}$$
</s>