# Ancora Imparo

## 22 February 2014

### Snail Problem, Part 2

Filed under: mathematics — Darmok @ 23:57 UTC
Tags: , , ,

I read through some more of my college differential equations textbook and I think I am ready to further tackle the snail problem (see yesterday’s post). In short, 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?

I got as far as this differential equation, which I believe is correct:

$\displaystyle \frac{dx}{dt} = \frac{2x}{2t + L_0} + 1$

I read about a technique to solve linear first-order differential equations last night, so I’m going to try it here. First we put this into standard form:

$\displaystyle \frac{dx}{dt} -\frac{2}{2t + L_0}\cdot x = 1.$

Since we already have an x’ and an x, if only they were multiplied by another function μ and μ’ respectively, we would have an inverse of the product rule (μx)’ = (μx’ + μ’x). Of course we can’t multiply different parts of the equation by different functions; we’ll have to multiply the entire equation by the same function μ(t). This will put a μ term in front of the x’, so we have to select a μ that, when multiplied by the function in the second term, will result in μ’. Let’s take a detour to find this function.

$\displaystyle \mu' = \mu\left( -\frac{2}{2t + L_0} \right)$

This is a separable differential equation; we can get the μ terms on one side and the t terms on the other. (Incidentally, I don’t think we could have done that with the original equation, or I would have.)

$\displaystyle \frac{d\mu}{dt} = \mu\left( -\frac{2}{2t + L_0} \right)$

$\displaystyle \frac{1}{\mu}\,d\mu = -\frac{2}{2t+L_0}\,dt$

I just realized we divided both sides by μ. I hope that was “allowed.” Of course we would have lost any solutions where μ = 0, though I’m not sure of the significance of that. In any case, I can’t stop now. Let’s integrate:

$\displaystyle \int \frac{1}{\mu}\,d\mu = \int \left( -\frac{2}{2t+L_0} \right) \,dt$

The left side is easy; it’s a standard rule.

$\displaystyle \ln |\mu|= \int \left( -\frac{2}{2t+L_0} \right) \,dt$

The right side is essentially the same; we need to use the inverse of the chain rule.

$\displaystyle \ln |\mu| = - \int \left( \frac{1}{2t+L_0} \right) (2) \,dt$

$\displaystyle \ln |\mu| = - \ln | 2t+L_0 | + c_1$

Exponentiating both sides yields

$\displaystyle e^{ \ln |\mu| } = e^{- \ln | 2t+L_0 | + c_1}$

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

Setting $c_2 := e^{c_1}$

$\displaystyle |\mu| = c_2 {|2t+L_0|}^{-1}$

$\displaystyle \mu = \pm \frac{c_2}{2t+L_0}$

I think we can absorb the ± into the constant (though I’m not positive).

$\displaystyle \mu = \frac{c_3}{2t+L_0}$

Actually, we need a solution, not all solutions, so I’ll set the constant equal to 1. So dropping the ± was fine.

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

Armed with μ, we should now be ready to return to our earlier work. We’ll take our previous equation, in standard form,

$\displaystyle \frac{dx}{dt} -\frac{2}{2t + L_0}\cdot x = 1$

and multiply both sides by the function μ:

$\displaystyle {(2t+L_0)}^{-1} \cdot \frac{dx}{dt} - 2{(2t + L_0)}^{-2} \cdot x = {(2t+L_0)}^{-1}$

We should now be able to a use the inverse of the product rule.

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

Integrating both sides gives

$\displaystyle {(2t+L_0)}^{-1} x = \int {(2t+L_0)}^{-1}\,dt$

We’ll need to use the inverse of the chain rule again, so let’s set it up.

$\displaystyle \frac{x}{2t+L_0} = \frac{1}{2}\int 2{(2t+L_0)}^{-1}\,dt$

$\displaystyle \frac{x}{2t+L_0} = \frac{1}{2} \left(\ln |2t+L_0| + c_4\right)$

$\displaystyle \frac{x}{2t+L_0} = \frac{ \ln |2t+L_0|}{2} + c_5$

Multiplying both sides by 2tL0 gives

$\displaystyle x = \left( \frac{\ln |2t+L_0|}{2} + c_5 \right) (2t+L_0)$

Wow, we already solved for x. I wasn’t expecting it so soon. The solution is a little more complex than I’d expected, and I suspect I made a mistake somewhere. However, we should keep going. Let’s find the constant. The snail starts at position x = 0 at time t = 0, so

$\displaystyle 0 = \left( \frac{\ln |0+L_0|}{2} + c_5 \right) (0 + L_0)$

L0 is positive, so we don’t need the absolute value.

$\displaystyle 0 = \left( \frac{\ln L_0}{2} + c_5 \right)L_0$

$\displaystyle 0 = \frac{L_0 \ln L_0}{2} + c_5 L_0$

$\displaystyle c_5 L_0 = - \frac{L_0 \ln L_0}{2}$

$\displaystyle c_5 = - \frac{\ln L_0}{2}$

This is actually promising. Substituting c5 back into the equation we solved for x,

$\displaystyle x = \left( \frac{\ln |2t+L_0|}{2} + c_5 \right) (2t+L_0)$

$\displaystyle x = \left( \frac{\ln |2t+L_0|}{2} - \frac{\ln L_0}{2} \right) (2t+L_0)$

$\displaystyle x = \left( \frac{\ln |2t+L_0| - \ln L_0}{2} \right) (2t+L_0)$

I want to get rid of the absolute value. I think we can. The natural logarithm is only defined for positive numbers (at least without using complex numbers), so the absolute value allows our function to be defined for all nonzero arguments (just like $1/x$). If I remove the absolute value function, then the logarithm and therefore the equation will not be defined for 2t + L0 < 0, or when t < -L0/2. Since negative time is meaningless in this example (the snail started at time t = 0), I don’t mind discarding those times. (As an aside, I haven’t kept the units, but the 2 in the denominator is actually 2 cm/d — the speed at which the twig grows. The time -L0/2 corresponds to the time at which the twig had length zero. Clearly it would be meaningless in this problem to consider times before this.)

Back to the problem:

$\displaystyle x = \left[ \frac{\ln (2t+L_0) - \ln L_0}{2} \right] (2t+L_0)$

$\displaystyle x = [\ln (2t+L_0) - \ln L_0] \cdot \frac{2t+L_0}{2}$

$\displaystyle x = \ln \frac{2t+L_0}{L_0} \cdot \left(t + \frac{L_0}{2}\right)$

$\displaystyle x = \left(t+\frac{L_0}{2}\right) \ln \left(\frac{2t}{L_0} + 1\right)$

And that’s it! That is the equation for the distance the snail has crawled, x, at any given time t. We haven’t actually answered the question of if the snail will reach the end and when that would be, but we can save that for the next post.

1. […] haven’t yet been able to solve this problem, but I’m preserving my initial attempts below. See Part 2 where I made more […]

Pingback by Snail Problem | Ancora Imparo — 23 February 2014 @ 00:06 UTC

2. […] 1 where I successfully set up the differential equation and unsuccessfully tried to solve it, and part 2 where I did manage to solve […]

Pingback by Snail Problem, Part 3 | Ancora Imparo — 23 February 2014 @ 20:28 UTC

3. […] 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 […]

Pingback by Snail Problem, Part 4 | Ancora Imparo — 27 February 2014 @ 06:29 UTC