# Solving a nasty equation

Here's an equation that I need to solve for $t_k$

$$\theta_0 = \tan^{-1}\left(\frac{2(w_x - m)}{p - g {t_k}^2 - 2 t_k w_y}\right) - {\frac{1} {r}} \left( \left(\frac{m}{t_k}\right)^2 + \left( \frac{p - g {t_k}^2}{2t_k} \right)^2 \right)$$

All other variables ($m,p,r,g,w$) are constants.

Mathematica fails solve it with the constants in place, but succeeds when the actual values are substituted in, so I know it's possible. Unfortunately, I need the general form for a computer program.

I'm certain it's failing due to the $tan^{-1}$.

So is there a way to convince Mathematica that the $tan^{-1}$ won't do anything funky on the interval in which I'm interested and just solve for the general case?

Here's the code.

ass[c_] := c /. {p -> -400, g -> -4/50, m -> -300,
a -> 0.45/50, r -> 27, u -> -2.3, v -> 0}
vx[t_] := (m/t) - u
vy[t_] := (p - g t^2)/(2 t) - v
rat[t_] := Simplify[-vx[t]/vy[t]]
ksq[t_] := (vx[t])^2 + (vy[t])^2
wholeWeak[t_] := ArcTan[rat[t]] - 1/(2 r^2 a)*ksq[t]

-
note that the LaTeX equation isn't exactly the one in the code but it's almost the same – soBinary Jun 11 '13 at 19:48
The arctangent is indeed the source of the trouble, but not for the reason you think. What you have is a transcendental equation, and these are usually not amenable to simple closed-form solutions. Your best recourse here is numerics. – J. M. Jun 11 '13 at 19:48
It doesn't look like the sort of equation Mathematica (or any CAS, really) can solve in closed form. Since, as you say, you need the solution for a computer program, you will want to implement Newton-Raphson iteration instead in that program of yours. – J. M. Jun 11 '13 at 19:55
Can you add an example case in which it succeeds? – Michael E2 Jun 12 '13 at 1:17
+1 for function names ass and rat. – gpap Jun 21 '13 at 11:12