# Checking units following differentiation

I'm trying to construct a simple mathematical model for a physical system, but my calculus is rusty and I'm tying myself in knots, especially with regard to the dimensions of the quantities I'm using.

The system obeys the equations

$$y = \frac{x - a}{\tau} \qquad for \qquad x > a$$ $$y = 0 \qquad for \qquad x \leq a$$

$x$ and $a$ have units of length, $\tau$ has units of time and $y$ has units of $L/T$. $a$ and $\tau$ are constants.

The discontinuity at $x = a$ causes me some problems later in my analysis, so I've been approximating it as

$$y = \frac{x -a}{\tau} g(x)$$

where

$$g(x) = \frac{1}{1 + e^{(a - x)}}$$

The function $g(x)$ switches fairly quickly from $\approx 0$ to $\approx 1$ at $x = a$, which gives a continuous representation of the discontinuity that is sufficiently abrupt for my purposes. In principle, $g(x)$ is just a dimensionless multiplier, but in reality both $a$ and $x$ have units and I'm a bit nervous about having these quantities inside my exponential.

In the next step, I need to differentiate

$$y = \frac{x - a}{\tau(1 + e^{(a - x)})}$$

with respect to $x$. This took me a depressingly long time by hand, but my answer (which agrees with Wolfram Alpha) is

$$\frac{dy}{dx} = \frac{(x - a)e^{(a - x)}}{\tau(e^{(a - x)} + 1)^2} + \frac{1}{\tau(e^{(a - x)} + 1)}$$

When I link all this together with the other ODEs in my system, everything works fine and the results look plausible, which is great. However, because of the way I constructed $g(x)$, the units/dimensions in the above equation no longer make sense, which makes me think I might be getting a sensible answer, but for the wrong reasons.

Is my general approach here valid, or is there a better/more rigorous way of thinking about this that would keep the units consistent?

Thanks very much!

• So basically you need to get units of acceleration?? – Archis Welankar Mar 28 '16 at 12:21
• @ Archis Welankar, No, I don't think so. The units of $\frac{dy}{dx}$ are $T^{-1}$, if that's what you mean? Perhaps I've misunderstood your comment? – JamesS Mar 28 '16 at 12:34

Strictly speaking, you want to let $k = 1$ with units of $1/\text{length}$ and put $$g(x) = \frac{1}{1 + e^{k(a - x)}},$$ a dimensionless quantity.
When you differentiate, factors of $k$ come out from the chain rule, keeping the appropriate factors dimensionless: $$\frac{dy}{dx} = \frac{k(x - a)\, e^{k(a - x)}}{\tau (1 + e^{k(a - x)})^{2}} + \frac{1}{\tau(1 + e^{k(a - x)})},$$ with units of $1/\text{time}$ throughout.)
• Yeah, I must admit, I initially ignored the units too. Then this morning a friend who's been working with my code pointed out the units didn't make sense, and I had one of those "Oh no..." moments! Is the second part of your comment referring to my suggested edit? If so, I hadn't meant to change any signs (apologies if I did), but I think there's a factor of $e^{k(a - x)}$ missing from the top of the first term in your second equation? Best wishes, – JamesS Mar 28 '16 at 13:35
• 1. You're perfectly correct that I dropped the $e^{k(a - x)}$ from the first term; fixed. 2. Apparently I mis-read the edit suggestion (and didn't notice it was you who had made it); my apology! – Andrew D. Hwang Mar 28 '16 at 13:48