I'm wrestling with a problem involving motion of a particle. The direction of the particle's motion is defined everywhere by a function $\mathbf G(\mathbf X)$. I keep coming down to a recursive algorithm for my solution, though, and I want to make it into an integral so I can do an analytic approach.
- $\mathbf P$ is the starting position of the particle.
- $\hat{\mathbf D}(\mathbf P)$ is a function that returns the (unit vector) direction to move at a given location.
- $S$ is the distance we want to travel.
- $\delta$ is the simulation step distance.
Pseudocode below.
$$\mathrm{nextPosition}\left(\mathbf P, \hat{\mathbf D}, S, \delta\right) = \begin{cases} \mathbf P &\mbox{if }S\leq 0 \\ \mathrm{nextPosition}\left(\left[\mathbf P + \delta\,\hat{\mathbf D}(\mathbf P)\right], \hat{\mathbf D}, (S-\delta), \delta \right) &\mbox{if }S\gt 0 \end{cases}$$
I recognize that I want to take $\lim_{\delta\to\infty}$ of my answer. After picking my brain (and various math sites) I haven't found a good way to convert my recursive approach to an integral, and I know I'm looking at this the wrong way.
I started looking at differential equations, but they were all in terms of velocity and acceleration. I'm just worried about the kinematics of the situation, moving a particle around without any regard to why.
How would I convert my recursive approach above to an integral or differential equation?
You need more than the direction of motion at a point, you need the velocity, too. $\mathbf G(\mathbf X)$ need to be a vector with length, not a unit vector. The length should be the velocity at $\mathbf X$. Similarly $\hat{\mathbf D}(\mathbf P)$ should not be a unit vector, in fact it is the same as $\mathbf G(\mathbf P)$ Then $\delta$ is the timestep of your simulation. If you do it by stepping, the step will be $\mathbf G(\mathbf P)\delta$, so in the limit that $\delta \to 0$you get $$\mathbf P(t)=\int_0^t\mathbf{G(P}(\tau)\mathbf)\; d\tau$$ Whether you can solve this analytically depends on the function $\mathbf G$