
Applied Math Applied Math Forum 
 LinkBack  Thread Tools  Display Modes 
February 10th, 2019, 11:58 AM  #1 
Newbie Joined: Nov 2018 From: Finland Posts: 1 Thanks: 0  Rational Solutions of the tan function in the context of a video game
First of all, I'd like to note that I believe I've already solved the problem I'm about to pose (it just comes down to there being just two rational solutions to the tan function) and as such, am not really in need of help with it. I'm only posting this as a log of a "realworld" application to whoever would find it of interest. Basically I'm studying a particular computer game. In the game, there are "actors" (objects) that move around a large plane. They can move in 1024 different directions with even spaces. Their movement on every frame is also an integer value. Likewise, coordinates are given as integers, meaning the game will round (in whichever way) a position resulting from movement in a given direction in each frame so that it fits onto a node in the grid. Actors will sometimes be made to home in on a particular point in the grid. Normally this causes them to start rotating (in the appropriate direction) until the direction they're facing is as close as possible to where they are going. There is a certain special behaviour that occurs only if an actor is facing exactly the opposite direction to a point it was homing in on. In fact this causes the actor to move in a straight line without knowing which way to rotate. If the actor was moving in an orthogonal direction with the target point exactly behind their backs (we can consider the actor a point as well), this behaviour continues indefinitely. The same if they were moving in one of the interorthogonal directions (45, 135, 225 or 315 degrees). All regardless of their movement speed. However, if they face any other direction, what tends to happen is they move straight for a brief instance, but then start rotating like normal. This, we know, is because their new position was rounded (whichever way) so the angle they're facing is no longer exactly opposite to where they're supposed to be going. The question then becomes: are there any angles besides the eight trivial ones an actor could be moving in where a particular movement speed causes their angle relative to the target point to stay constant? Any amount of rounding (unless rounding equal amounts along the x and yaxes, will, obviously, also change the angle relative to the target point, and thus this amounts to the actor having to hop gracefully in integer steps from the center of one point to the center of another, facing one of the 1024 possible directions. If the movement vector, the xoffset and the yoffset are all integers, we get a rightangled triangle whose sides form a Pythagorean triplet. Thus if we could get an actor to move at an angle of (arctan 3/4) at a speed of 5 (or any multiple thereof), this would indeed be possible. However, arctan (3/4) / 360 x 1024 is not an integer, and thus we simply cannot face that particular angle. I went through the other five smallest Pythagorean triplets to confirm that it should indeed be impossible to find such an angle in this game, seeing as, in practice, nothing can be made to move faster than around 3000 units/frame, giving an upper bound to the slanted movement vector. Intuitively, I suspect there are no solutions at all (I have now found something that seems to confirm that). If so, the answer to this question may be equivalent to proving the irrationality of the rest of them. I hope I have expressed this in a sufficiently clear manner. Again, this is simply to show an unusual application. Feel free to comment. 

Tags 
context, function, game, rational, solutions, tan, tangent, video 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
A Rational Game  AplanisTophet  Real Analysis  62  April 1st, 2018 08:52 PM 
Fun with visually graphing video game stats  Apothem  Computer Science  3  August 11th, 2012 09:49 PM 
BASIC VIDEO GAME MATH!!  NukkaD  Computer Science  6  June 22nd, 2011 08:06 PM 
Infinitely many rational solutions on the curve?  ultramegasuperhyper  Number Theory  0  June 13th, 2011 04:34 AM 
Stumped off a video game  oldman321  Algebra  1  March 6th, 2008 11:35 AM 