SERIOUSLY ?
Opps, sorry, my caps-lock gets stuck sometimes. I guess your problem may be due to a copy-paste mistake. You have a global / local scope naming conflict.
double px0;
double py0;
double vx0;
double vy0;
double px1;
double py1;
double vx1;
double vy1;
double T;
double r = 40;
void
Experiment::AdvancePosition0 (Ptr<Node> node0)
{
Vector pos0 = GetPosition (node0);
Vector vel0 = GetVelocity (node0);
double px0 = pos0.x;
double py0 = pos0.y;
double vx0 = vel0.x;
double vy0 = vel0.y;
double param = ((pow((vx1 - vx0),2) + pow((vy1 - vy0),2)) * pow(r,2)) - pow((((vx1 - vx0) * (py1 - py0)) - ((vy1 - vy0) * (px1 - px0))),2);
double T = (-(((vx1 - vx0) * (px1 - px0)) + ((vy1 - vy0) * (py1 - py0))) + sqrt(param)) / (pow((vx1 - vx0),2) + (pow((vy1 - vy0),2)));
In each function you used one local scoped variable (which is updated) and one global scoped one (which you didn't update).
As a result, in each function there's a variable with an uninitialized value.
This may be the root of your problem.
However, I'd strongly suggest to double check your code design. Such a mixture of local and global scoped variables usually is the symptom of some other kind of issue, Design issues usually.
T.