0
$\begingroup$

I am running a simulation of two bicycles traveling in the same direction in a single dimension. Bicycle A is $z$ meters behind bicycle B. The acceleration of each bicycle determined by the power (P) produced by the cyclist and a number of drag factors (simplified below):

$v'(t) = (\frac{P}{v} - 0.6v^2) \frac{1}{m}$

I'm trying to determine a value of P for bicycle A (given an initial velocity) such that after $k$ seconds, the two bicycles would be in the same location. I can assume that bicycle B has reached some steady state velocity $(v_b)$. Without being able to find a closed form solution for the displacement in terms of time, power and initial velocity, is there any way to calculate or approximate this value? The best approach I have right now is to manually simulate several values of P and choose the one that is closest to $z+kv_b$

$\endgroup$

1 Answer 1

1
$\begingroup$

This is the kind of problem that can definitely be solved numerically. You said "simulate several values and choose the one that is closest". In fact, you need two things. One - you need to be able to integrate the equation of motion so you get the distance covered in $k$ seconds; and two - you need a way to iterate over values of $P$.

I would suggest that you write a function that solves problem (1) - input would be $P$ and $z$, and output would be time $t$. You then evaluate this function at two different values for $P$. Perhaps you start with the assumption of constant force - you can solve the equation for A catching B over a distance z in time k, I suppose.

Dividing that force by the final velocity of A gives you a sense of the power $P_1$ needed. This initial value is then plugged into the function you created, and you get a first value for $t=t_1$. Your second estimate, $P_2$, should now be scaled by the error in your result: $P_2 = P_1 \frac{t_1}{k}$. If you took too long, you need to increase the power.

Once you have two values, you can use Newton's method: determine the slope of the $P-t$ curve from the two pairs of values, and draw a straight line to determine the most likely value of $P_3$. You can then pick the two points on either side of the solution, and iterate further as needed.

For these problems that don't have a good closed form solution, that's usually the best you can do. You can either stop after a fixed number of iterations, or after the result is "close enough".

See for example Newton's method.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.