Suppose we have the following equation that is not defined if $g=0, d=0$ or the expression under the radical is negative: $$ y = \arctan \left( \frac{v^2 \pm \sqrt{v^4 - 2gv^2h-g^2d^2}}{gd}\right) $$
But its actually angles need for a cannon with speed $v$ to shoot a $(d,h)$ point in an environment with gravitational acceleration of g.
Couldn't load the picture ($h$ is height, $d$ is distance)
if $d=0$, the point is over the cannon and it should give 90 degrees if v is enough.
if $g=0$, the the path would be a straight line so should give us the following : $\arctan (h/d)$ and not any other angle because only one line passes two points
under radical is a bit tricky but i guess it limits the $v$ to a range that it it can be actually possible to hit the point, if $v$ is small enough it will hit the ground or go below its height before reaching it. And may be some other combination of $\{v,g,h,d\}$?
And other situations...
My question is:
I've found these out by its physical interpretations instead of math itself and i believe math is really really more powerful than that How should i find these with math only and for other equations?
You can use $\text{atan2}(x,y)$, that as two varible function can carry the sign of its arguments that are lost in calculations with $\arctan(y/x)$. Division by zero is not a problem neither. Anyway, we can do the same using limits, as suggested by gt6989b.
$y = \text{atan2} \left(v^2 \pm \sqrt{v^4 - 2gv^2h-g^2d^2},gd\right)$
$d=0$. There are two cases:
First, $y_+=\text{atan2}\left(v^2+\sqrt{v^4 - 2gv^2h},0\right)=\pi/2$ and for the max heigh, because $v^2\sqrt{v^2-2gh}$ must be real: $v^2\geq2gh\implies h\leq v^2/2g$, as expected.
Second, $y_-=\text{atan2}\left(v^2-\sqrt{v^4 - 2gv^2h},0\right)$ with $h\leq v^2/2g$ as before, but $y_-=\pi/2$ if $0\leq h\leq v^2/2g$ and $y_-=-\pi/2$ if $h\lt0$
In this situation, $d=0$, we have two angles to pass by some position $(0,h)$ as we have in the general case ($d\neq0\;;h\neq0$), simply, for $h\geq0$ they both coincide.
$$y_g=\lim_{g\to0}\arctan \left(\dfrac{v^2-\sqrt{v^4 - g(2v^2h+gd^2)}}{gd}\right)=$$
$$=\lim_{g\to0}\arctan \left(\dfrac{v^4-v^4+g(2v^2h+gd^2)}{gd(v^2+\sqrt{v^4 - g(2v^2h+gd^2)})}\right)=$$
$$=\lim_{g\to0}\arctan \left(\dfrac{2v^2h+gd^2}{d(v^2+\sqrt{v^4 - g(2v^2h+gd^2)})}\right)=$$
$$=\arctan(h/d)$$
As you expected. The weird solution can be understood if we consider that it is a limiting case: we have two paths that can reach a point $(d,h)$. Now, as the gravity faints, one of the paths straighten, but the other needs more and more time to let the gravity to act and make the, say, returning trip. At the end, with $g$ effectively zero, no return is possible and this simply means that the gravity is essential to have two paths!!
$v^2\geq gh\pm\sqrt{g^2h^2+g^2d^2}=g(h\pm\sqrt{h^2+d^2})$, dropping the solution with the minus sign as the result is unphysical.