Snail Problem, Part 4

In the last three posts (see Snail Problem parts 1, 2, and 3), I tackled the following problem: a snail crawls along a twig of length L0 at 1 cm/d, and the twig grows 2 cm/d. Will the snail reach the end, and when?

The answer is yes, and it will reach the end in

\displaystyle t = (e^2-1)\cdot\frac{L_0}{2}.

I’m interested in solving this now for the general case, leaving the twig growth and snail velocities unspecified. Fellow blogger Ken Roberts has already solved this, but I still want to try my hand at it. I’ll follow his example and use g for the growth rate of the twig (I’m already using t for time), s for the inherent velocity of the snail, and I’ll continue using L0 for the initial length of the twig (and L for its length at any time).

The length of the twig L is

\displaystyle L(t)= gt+L_0 ,

since it grows at g cm/d and its grown for t days. The velocity at any point x is length is the fraction of the length of the twig,

\displaystyle \frac{x}{L(t)} = \frac{x}{gt + L_0}

times the twig’s overall growth rate, g:

\displaystyle \frac{gx}{gt + L_0} .

The net velocity v of the snail is the sum of the growth of the twig at that point (which we just calculated) and its own inherent velocity, s:

\displaystyle v = \frac{gx}{gt + L_0} + s

Of course, v is the derivative of the snail’s position x with respect to time. Remember that L0, g, and s are constants.

\displaystyle \frac{dx}{dt} = \frac{gx}{gt + L_0} + s

This is a linear first-order differential equation.

\displaystyle \frac{dx}{dt} - \frac{g}{gt + L_0}x = s

The way to solve this is to multiply by the following integrating factor (see part 2 for an explanation):

\displaystyle \mu(t) = e^{\int \left(-\frac{g}{gt + L_0}\right) \,dt}

\displaystyle \mu(t) = e^{-\int g\cdot\frac{1}{gt + L_0}\,dt}

\displaystyle \mu(t) = e^{-\ln|gt+L_0| + c_1}

I actually might prefer doing this the other way (the longer method from the previous post), since integrating inside an exponent is inconvenient. Using sum and product rules for exponents:

\displaystyle \mu(t) = e^{c_1}{\left(e^{ln |gt+L_0|}\right)}^{-1}

\displaystyle \mu(t) = c_2(gt+L_0)^{-1}

I got rid of the absolute value because the quantity gt + L0 will always be positive, since it’s the length of the twig. And more generally, we can select a quantity for the constant that would have the appropriate sign. We just need one possible solution for this integrating factor, so I’ll select the one where the constant is equal to one.

\displaystyle \mu(t) = (gt+L_0)^{-1}

Now we take this and multiply it by our prior differential equation.

\displaystyle (gt+L_0)^{-1}\left(\frac{dx}{dt} - \frac{g}{gt + L_0}x\right) = (gt+L_0)^{-1}s

\displaystyle (gt+L_0)^{-1}\frac{dx}{dt}-g(gt+L_0)^{-2}x = \frac{s}{gt+L_0}

The whole point of this diversion was to get the left side of the equation into a form that is the inverse of the product rule.

\displaystyle \frac{d}{dt}\left[(gt+L_0)^{-1}x\right] = \frac{s}{gt+L_0}

Integrating both sides with respect to t gives

\displaystyle (gt+L_0)^{-1}x = \int\frac{s}{gt+L_0}\,dt

\displaystyle (gt+L_0)^{-1}x = s\int\frac{1}{gt+L_0}\,dt

We need to set up the inverse of the chain rule.

\displaystyle (gt+L_0)^{-1}x = \frac{s}{g}\int\frac{g}{gt+L_0}\,dt

\displaystyle (gt+L_0)^{-1}x = \frac{s}{g}\left(\ln|gt+L_0| + c_3\right)

We can multiply through by s/g, and define a new constant. Also, I’ll remove the absolute value, since I’m only interested in positive t.

\displaystyle (gt+L_0)^{-1}x=\frac{s}{g}\ln(gt+L_0) + c_4

\displaystyle x = \left[\frac{s}{g}\ln(gt+L_0) + c_4\right](gt+L_0)

We can find the constant by noting that when t=0, x=0:

\displaystyle 0 = \left(\frac{s}{g}\ln L_0 + c_4\right)(L_0)

Dividing both sides by L0 gives

\displaystyle 0 = \frac{s}{g}\ln L_0 + c_4

\displaystyle c_4 = -\frac{s\ln L_0}{g}

Substituting this back into our equation for x:

\displaystyle x = \left[\frac{s}{g}\ln(gt+L_0) -\frac{s\ln L_0}{g}\right](gt+L_0)

\displaystyle x = \frac{s}{g}\left[\ln(gt+L_0)-\ln L_0\right](gt+L_0)

Let’s combine the natural logarithms and rearrange the terms for clarity:

\displaystyle x= \frac {s}{g}(gt+L_0)\ln\frac{gt+L_0}{L_0}

That’s it! Noting that the quantity gt+L0 represents the current twig length, L, we can say that

\displaystyle x = \frac{s}{g}L\ln\frac{L}{L_0} .

In other words, at any given time, the position of the snail is equal to the ratio of the snail’s inherent velocity to the twig growth velocity times the current twig length times the natural logarithm of the ratio of the twig’s current length to its original length. Keeping it in this form, using the general case rather than s=1 and g=2, certainly makes the formula more intuitive. I’ll solve for the time it takes to reach the end of the twig in the next post.