An angry bird is shot at an angle \$β\$ to the horizontal at a speed \$u\$. The ground is steep, inclined at an angle \$α\$. Find the horizontal distance \$q\$ that the bird traveled before it hit the ground.
Make a function \$f(α, β, u)\$ that returns the length \$q\$: the horizontal distance that the bird traveled before it hit the ground.
Constraints and notes:
- \$-90° < α < 90°\$.
- \$0° < β < 180°\$.
- \$α < β\$.
- \$0 \le u < 10^9\$.
- Assume acceleration due to gravity \$g = 10\$.
- You may use radians instead of degrees for \$α\$, \$β\$.
- Dimensions of \$u\$ are irrelevant as long as they are consistent with \$g\$ and \$q\$.
- No air resistance or anything too fancy.
Shortest code wins.
See the Wikipedia article on projectile motion for some equations.
f(0, 45, 10) = 10 f(0, 90, 100) = 0 f(26.565, 45, 10) = 5 f(26.565, 135, 10) = 15