Known quantities: Initial position $x_i, y_i$, initial velocity components $V_{ix}$ and $V_{iy}$, and mass $m$.
I can apply a force $F$ pushing me towards arbitrary point $P$, and then I must update the velocities accordingly the next time unit. (This is all for a game AI).
My attempt:
If I choose some point $P$ with coordinates $x_f$ and $y_f$ then the angle $\theta$ formed is part of the expression $\displaystyle \cos(\theta) = \frac{\Delta x}{d} = \frac{x_f-x_i}{d}$ where $d = \sqrt{(x_f-x_i)^2 + (y_f-y_i)^2}$.
The force applied relates to $F = ma$ so I can solve for $a = \frac{F}{m}$.
Now somehow I have to update the velocity components. We have $\displaystyle \cos(\theta) = \frac{V_{fx}}{V_f}$ (velocity in the $x$ direction over velocity in the diagonal pointing to $P$). And in general we have $V_i + a = V_f$.
I'm a little bit lost for how to update the velocities, for example solving for $V_{fx}$.
If I set the cosine stuff equal to each other we get
$$\frac{\Delta x}{d} = \frac{V_{fx}}{V_f}$$
So that means $\displaystyle V_{fx} = \frac{V_f \cdot \Delta x}{d} = \frac{(V_i + a) \cdot \Delta x}{d}$
At this point I feel like I am getting way off track and I could use some help getting it right.
At the risk of being downvoted and rebuffed as waffling, I believe it would be useful for the OP and anyone encountering this question as a result of a search on similar terms, to look at a quick summary on the simplest way to numerically simulate the effect of forces on a point-like object.
(Why point-like? So that we can ignore any internal structure.)
First thing to realize, is that in numerical simulations, time is discretized to short intervals. Often, the intervals are of fixed (game-time) duration, to simplify the math involved. The key thing, however, is to realize that each step does not correspond to one instance of simulated continuous time, but to an interval. In mathematical terms, we need to integrate the instantaneous effects over the interval, to calculate (approximate) the effects during that interval.
Let's assume that for each object, at the start of each time step, we know their location/position vector $\vec{x}$, their velocity vector $\vec{v}$, and the sum of all forces that apply to it for the duration of the time step (about to be simulated), $\vec{F}$. If you have more than one force, you simply sum their vector components together. Let's use $\tau$ to describe the duration of the time step.
The simulated object has momentum $\vec{p} = m \vec{v}$, where $m$ is the mass of the object. If the mass of the object and the force acting on the object stay constant during the time step, then according to Newton's second law of motion, $$m \vec{a} = \vec{F} \iff \vec{a} = \frac{1}{m} \vec{F}$$ where $\vec{a}$ is the acceleration during the time step. Noting that $$\vec{v}(t) = \int_{0}^{t} \vec{a}(\tau) d \tau = \vec{v}(0) + \frac{t}{m} \vec{F}$$ and that $$\vec{x}(t) = \int_{0}^{t} \vec{v}(\tau) d \tau = \vec{x}(0) + \vec{v}(0) t + \vec{F} \frac{t^2}{2 m}$$
In discrete time units, this means that $$\vec{x} \leftarrow \vec{x} + \vec{v} \tau + \vec{F} \frac{\tau^2}{2 m}$$ and $$\vec{v} \leftarrow \vec{v} + \frac{\tau}{m} \vec{F}$$
In pseudocode in 3D:
If the mass of the object changes during the timestep, for example like in a rocket or some kind of thruster, we should use $$m(t) \vec{a}(t) = \vec{F}(t) + \vec{u}(t) \frac{d m}{d t}$$ where $u$ is the velocity vector of the exhaust, and $\frac{d m}{d t}$ is the rate of change of mass, negative for exhaust. I do believe the continuous-time solution for $\vec{a}(t)$ (with constant force $\vec{F}$) is $$\vec{a}(t) = \frac{\vec{F} + w \vec{u}}{m_0 + w t}$$ where mass changes as $m(t) = m_0 + w t$; that integrates to $$\vec{v}(t) = \vec{v}(0) + \left ( \vec{u} + \frac{\vec{F}}{w} \right ) \log \left ( \frac{t w}{m_0} + 1 \right )$$ and again to $$\vec{x}(t) = \vec{x}(0) + \left( \vec{F} \left ( \frac{t}{w} + \frac{m_0}{w^2} \right ) + \vec{u} \left ( t + \frac{m_0}{w} \right ) \right ) \log \left ( \frac{t w}{m_0} + 1 \right ) + t \left ( \vec{v}(0) - \vec{u} \right ) - \vec{F}\frac{t}{w}$$ At the limit $w = 0$, these simplify to the constant-mass functions earlier above. So, the pseudocode to implement a time step when the mass of the object changes, would be