Point, bar and a mass This question is a simplified down version of my first question to understand the core essentials of my question. The question now stands with the simplified diagram:

There are three things in the diagram:


*

*The red dot (I will call this point $p$)

*A mass labeled $m$

*And a bar connecting point $p$ to $m$


The description of the environment:


*

*No gravity

*No friction

*$p$ is massless

*The bar is massless

*The bar is a fixed size

*The bar pivots at $p$ (also frictionless)

*$m$ is a point mass


What I need to find out:
Given that point $p$ has a velocity $v_p$ and acceleration $a_p$ what is the resulting force on $m$?
My view on how the system should work:


*

*Given that the force applied to $p$ is parallel to $m$ and $m$ contains no momentum: $m$ should move in tandem with $p$'s movement.

*Given that the force applied to $p$ is not parallel to the bar, $m$ shall move towards $p$, but also cause $m$ to move tangential to the bar and carry rotational momentum.

*Should $p$ be fixed in a location and mass $m$ containing momentum that is not parallel to the bar: the mass $m$ should "orbit" around point $p$ at a constant rotational velocity until $p$ moves.


My ideas:


*

*Torque? $\tau = r \times \vec{F}$, where $\vec{F} = m \times \vec{p_a}$


*

*This formula doesn't seem right to me for some reason

*Additionally, I am not sure that this formula helps understand the change in momentum for mass $m$


*Tension of the bar?


*

*This one is simple enough and I know it plays a significant part in physics, but I am not sure how this would help to find out how $m$ carries rotational momentum. I already constrain $m$ to be $r$ units away from $p$, do I need to show the force that was needed to perform that action?


*Momentum! $p = mv$ (where $p$ in this case is momentum) and $\Delta p = \vec{F}\Delta t$


*

*I am pretty sure that this is in here as conservation of momentum stated that the object in motion will remain in motion until acted upon by an outside force.

*I am not sure how to represent angular momentum either.


 A: I would do it in the frame of $p$. You will see a fictitious force which will basically look like a gravity. This "gravity" will have an acceleration equal to $-a_p$. So basically the problem of a pendulum with a fixed pivot in a time varying gravitational field. That shouldn't be so bad. So to answer your question the force on $m$ is $m(\vec{a}_p \cos \theta + (\vec{v}_p - \vec{v}_m)^2\hat{r}/r)$, where $\vec{r}$ is the displacement from the mass to $p$, and $\theta$ is the angle between $\vec{r}$ and $\vec{a}_p$. 
I made a jsfiddle thing of my own based off of your code. Here it is http://jsfiddle.net/y14hce3r/2/.
A: I am a bit confused about you constraints. You write that $p$ is massless, and in the next sentence you let is have a velocity and and an acceleration.
Since $p$ is massless it will not exert any force on $m$ since $F=m_p\cdot a_p=0\cdot a_p=0$.
A assume you are trying to solve a problem where $p$ is really moved my external forces such that it has velocity $v_p$ and acceleration $a_p$, and $m$ is just dragged along with it, correct?
This is actually rather complicated since you are starting out with a finite velocity for $p$. As the rod is stiff the immediate force on $m$ will be infinite, as enough momentum has to be transferred to follow $p$ rigidly.
Thus in order to have a physical answer you will need to set $v_p=0$ and then just look at the response to acceleration.
A: Here is how I would approach it - given that you are doing a numerical simulation, you only need to be able to describe what happens in the next infinitesimal interval of time.
At any moment in time, the mass $m$ has a certain velocity - one component of that velocity will be along the rod, and the other component will be perpendicular. When point $p$ moves, its velocity can also be decomposed into a component $v_{p,r}$ and $v_{p,\theta}$. At any moment, $v_{m,r}=v_{p,r}$ because of the stiff rod, but the other components are arbitrary.

However, a small time step later, a difference in velocity between the two tangential velocities will change the angle of the rod; this in turn will change the relative components, and so it goes.
From this you can compute the motion of $m$. And once you have the motion, you know the force, which is of course given by $F=m\cdot a= m \frac{dv}{dt}$.
I started writing some code to implement this; I updated this, and now it seems to work for a couple of very simple cases (with constant acceleration, the mass behaves like a pendulum as expected). You will want to tweak the time step, and check that the integration doesn't result in accumulated errors...
#include <stdio.h>
#include <math.h>

#define DT 0.1 // timestep

typedef struct {
  double r;
  double px, py, mx, my;
  double vpx, vpy, vmx, vmy, vpr, vpth, vmr, vmth;
} state;

void update(state *s, double apx, double apy);
void printState(state *s);

int main(void) {
state s;
s.vpx=0;
s.vpy=0;
s.vmx=0;
s.vmy=0;
s.px=0;
s.py=0;
s.r = 10;
s.mx = s.px + s.r;
s.my = 0;
int ii;
printState(&s);
for(ii=0; ii<200; ii++) {
  update(&s, 0, 0.5); // constant vertical acceleration
  printState(&s);
}
return 0;
}

void update(state *s, double apx, double apy) {
  // compute angle of rod:
  double dx, dy, v1, v2;

  // update velocity of p:
  v1 = s->vpx;
  v2 = s->vpx += apx * DT;
  s->px += 0.5*(v1 + v2) * DT;
  v1 = s->vpy;
  v2 = s->vpy += apy * DT;
  s->py += 0.5 * (v1+v2) * DT;

  // rhat vector: normalized dx, dy:
  dx = s->mx - s->px;
  dy = s->my - s->py;
  double theta = atan2(dy, dx);
  double rhatx, rhaty, rnorm;
  rnorm = sqrt(dx*dx+dy*dy);
  rhatx = dx / rnorm;
  rhaty = dy / rnorm;

  // components of velocity along and perpendicular to rod:
  s->vpr  = s->vpx * rhatx + s->vpy * rhaty;
  s->vpth = -s->vpx * rhaty + s->vpy * rhatx;
  s->vmr  = s->vpr;
  s->vmth = -s->vmx * rhaty + s->vmy * rhatx;

  // update velocities:
  s->vmx = s->vmr * rhatx - s->vmth * rhaty;
  s->vmy = s->vmr * rhaty + s->vmth * rhatx;

  // and positions
  s->mx += s->vmx * DT;
  s->my += s->vmy * DT;
  // impose constraint of constant rod length...
  dx = s->mx - s->px;
  dy = s->my - s->py;

  double stretch = s->r / sqrt(dx*dx + dy * dy);
  s->mx = s->px + dx * stretch;
  s->my = s->py + dy * stretch;
}

void printState(state *s) {
  printf("px = %5.2f; py = %5.2f; mx = %5.2f; my = %5.2f; ", s->px, s->py, s->mx, s->my);
  printf("vpx = %5.2f; vpy = %5.2f; vmx = %5.2f; vmy = %5.2f\n", s->vpx, s->vpy, s->vmx, s->vmy);
  //printf("vpth = %5.2f; vpr = %5.2f; vmth = %5.2f; vmr = %5.2f\n", s->vpth, s->vpr, s->vmth, s->vmr);

}

