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!
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.)