# Does the logarithm of a non-dimensionless quantity make any sense?

A train consists of an engine and $$n$$ trucks. It is travelling along a straight horizontal section of track. The mass of the engine and of each truck is $$M$$. The resistance to motion of the engine and of each truck is $$R$$, which is constant. The maximum power at which the engine can work is $$P$$.

The train starts from rest with the engine working at maximum power. Obtain an expression for the time $$t$$ taken to reach a given speed $$v$$.

I wrote $$a(t)=\frac{P}{v(t)M(n+1)}-\frac{R}{M} \tag{1}$$

Putting $$(1)$$ into standard differential form: $$[M(n+1)v]dv+[(Rv(n+1)-P)]dt=0 \tag{2}$$ Since $$(2)$$ is non-exact, let $$M(n+1)v=f(v) \tag{3}$$ and $$(Rv(n+1)-P)=g(v) \tag{4}$$ Since $$\frac{1}{g}\left(\frac{\partial f}{\partial t}-\frac{\partial g}{\partial v}\right)=\frac{R(n+1)}{P-Rv(n+1)}=h(v) \tag{5}$$ i.e. a function of $$v$$ only.

The integrating factor to $$(2)$$ is then given by: $$I(v)=e^{\int h(v)dv}=e^{-\ln(P-Rv(n+1))}=\frac{1}{P-Rv(n+1)} \tag{6}$$ The final solution then looks something like this $$M(n+1)\left[\frac{-Rv(n+1)-P\ln(P-Rv(n+1))+P\ln(P)}{R^2(n+1)^2}\right]-t=0 \tag{7}$$

But doesn't the argument of $$\ln()$$ have to be some dimensionless quantities for it to make sense? (I got $$\ln(P)$$ and $$P$$ is not dimensionless in this case.)

Can someone please explain where my conceptual errors lie?

• Related: physics.stackexchange.com/q/364771/2451 , physics.stackexchange.com/q/13060/2451 and links therein. May 24 '20 at 7:00
• May 25 '20 at 9:58
• Can the double negative "non-dimensionless" be eliminated? May 25 '20 at 16:43
• I think it could. For example, $\rm{\log 2m = \log (2 \cdot m) = \log 2 + \log m}$. The second has probably no meaning, but it can fall off in a substitution. May 25 '20 at 16:57

In equation (7) you have the expression $$−P\ln(P−Rv(n+1))+P\ln(P)$$

But since this a difference between two logarithms you can rewrite the expression (remember $$\ln a - \ln b = \ln \frac ab$$) as $$P\ln\left(\frac{P}{P−Rv(n+1)}\right)$$

Now you have the logarithm of a dimension-less quantity, as it should be.

The reason behind this problem is that you've not yet simplified the final expression.

For example, let's suppose you get a term $$\ln (f(v))$$ in your final indefinite integral, where $$f(v)$$ has dimensions and isn't dimensionless. This is, as you noted, weird as a logarithm's arguments should always be dimensionless. But, now if you apply the limits, you get

$$\ln(f(v))\biggr|_{v_1}^{v_2} = \boxed{\ln\left(\frac{f(v_1)}{f(v_2)}\right)}$$

Now, as you see, the boxed expression is perfectly valid. The argument in the logarithm is, as expected, dimensionless. So, there will never be a case where you'd encounter an expression like $$\ln(\text{quantity with dimension})$$ if you apply the limits and then analyze the expression.

$$I(v)=e^{\int h(v)dv}=e^{-\ln(P-Rv(n+1))}=\frac{1}{P-Rv(n+1)} \tag{6}$$

If $$v$$ is has non-trivial dimensions, then $$\int \frac{1}{v} dv = \ln\left|\frac{v}{D}\right|$$, where $$D$$ is equivalent to $$e^{-C}$$ in the dimensionless case: $$\int \frac{1}{x} dx = \ln\left|x\right| + C = \ln\left|x\right| - \ln e^{-C}$$.

If $$v$$ is in $$\left.\mathrm{m}\middle/\mathrm{s}\right.$$, for example, we could write:

$$\int \frac{1}{v} dv = \ln\left|\frac{v}{1\ \left.\mathrm{m}\middle/\mathrm{s}\right.}\right| + C$$

Yes, you can take the logarithm of a dimension. It's basically the same thing as taking the square of a dimension: it's mathematically valid and makes sense, but, obviously, it's not generally equivalent to the dimension itself. For example, both $$\mathrm{K}^2$$ and $$\ln{\left(\mathrm{K}\right)}$$ make sense, but neither is equivalent to $$\mathrm{K} .$$

If you get stuck, you can remember that $$\ln{\left(ab\right)} ~=~ \ln{\left(a\right)} + \ln{\left(b\right)} \,,$$ so you can rewrite any log of a scalar-dimension-having quantity as $$\ln{\left(x\right)} ~=~ \underbrace{\ln{\left(\frac{x}{\operatorname{dim}{\left(x\right)}}\right)}}_{\begin{array}{c}\text{dimensionless}\\[-25px]\text{factor}\end{array}} ~+~ \underbrace{\ln{\left(\operatorname{dim}{\left(x\right)}\right)}}_{\begin{array}{c}\text{isolated}\\[-25px]\text{units}\end{array}} \,.$$

The resulting math works like always, where the general rule's that both sides of an equation must be equal for the equation to hold. So if you end up with $$1 + \ln{\left(\mathrm{K}\right)} = 2 + \ln{\left(\mathrm{K}\right)} - 1 \,,$$ that's perfectly legal, as the $$ \ln{\left(\mathrm{K}\right)} "$$ cancels out on both sides, satisfying the equality. Of course, if the units don't cancel, then there's a dimensional error.

Note that the heuristic against adding terms with differing dimensions no longer holds. That heuristic only works when valid modes of constructing sums with terms of differing dimensions are avoided, which isn't the case here. This may lead to confusion in non-technical settings. For example, probably don't want to present a PowerPoint in a business meeting that refers to $$ 100 + \ln{\left(\mathrm{USD}\right)} ";$$ the math can be useful if you're doing calculations, but some folks find it confusing.

• This is non-standard, do you have a reference where it is worked out more rigorously?
– fqq
May 25 '20 at 16:47
• Anyway, requiring to have the right "+ln(dim)" terms on both sides seems basically a way to require (the more standard) adimensionality
– fqq
May 25 '20 at 16:48
• No, it's not "intro-level". The standard answer would be that log of dimensional quantities don't make sense. It might well be the case that you can define an appropriate logarithm function on some algebraic structure representing dimensional quantities, but it is not the usual logarithm and you have to prove its properties etc (e.g. the identity you write is valid for the natural logarithm, but fails already with complex numbers)
– fqq
May 25 '20 at 16:56
• Otherwise, I agree that what you say works, but it's just formal/sloppy notation for keeping the adimensional quantities coherent. What's log(metre)?
– fqq
May 25 '20 at 16:57
• I hadn't thought of things in terms of adding logarithms, but could see that it would make sense that if one regarded what would often be written as "5dBm" as instead "5+dBm", then converting signal it to dBW would require adding (dBW-3-dbM), thus yielding "2+dBW". May 25 '20 at 18:16

It amazes me that people think that (1) the argument to the log function can't have units and (2) that physical scientist have been playing fast and loose with mathematics for centuries. The Log is the integral of $$dx/x$$. An integral is an infinite sum so to determine the resulting units we only need to know the units of one term (since all other terms must have the same units to allow for their summation). So the units of log are the units of $$dx/x$$. $$dx$$ has the same units as x therefore the ratio is unitless and therefore the log is also unitless. There is absolutely nothing mathematically incorrect about taking the log of a quantity with units, and the result is always unitless. That is intrinsic to the mathematics of a log. However, that means that the Log is a lossy function. There is no way to recover the units once you take the log and, for example, $$10^{\log(x)} != x$$ if $$x$$ had units. (There is not all that uncommon in mathematics, that the inverse doesn’t perfectly recover the original value, for example $$\sqrt{x^2} != x$$ for all $$x$$.)

• What are your limits of integration when you say that $\log$ is the integral of $dx/x$? Jul 22 '20 at 22:14

You can fix this ex post as some answers pointed out, but what you really want to do if you don't want to do fancy stuff with dimensions is to fix it ex ante or rather convince yourself that you could fix it ex ante and then work the simple way.

Let's look at a definition of the logarithm that clearly doesn't allow arguments which carry a dimension, namely $$\ln x\equiv \int^x_1 \frac{du}{u}.$$ It clearly doesn't make sense for an $$x$$ that is not dimensionless because then the upper and lower limit would have different dimensions. Imagine writing a Riemann sum for this.

So what happens when we evaluate a logarithmic integral involving dimensions on both limits (dimension $$D$$, say)? Let's take our integral to be $$\int_{aD}^{bD} du/u$$ with $$a,b$$ real numbers, and the dimension made explicit. Using straightforward substitution $$u\to vD$$ we can move the dimension from the limits into the integrand and see that $$\int_{a D}^{b D} \frac{d u}{u} = \int_{a}^{b} \frac{D d v}{v D} = \int_a^b \frac{dv}{v},$$ i.e. the dimension disappears from the integral. We can continue evaluating $$\int_a^b \frac{dv}{v} = \ln\frac{b}{a} = \ln\frac{bD}{aD},$$ (reinserting the dimension trivially by multiplying by $$1=D/D$$) and then use the last equality to define $$\ln bD - \ln aD =: \ln\frac{b}{a},$$ and then we recover (formally) the usual antiderivative relation, independent on whether $$u$$ has a dimension or not $$\int \frac{du}{u} = \ln u + C.$$ Once we did this, doing the calculation using antiderivatives without first taking care of the dimensions is justified.

I will say that I found this one of the most fascinating properties of logarithms when I first stumbled over this in my undergraduate studies. You cannot do something similar for the sine function, say. The logarithm in a way is the ideal power, and its habit of eating up dimensions allows it to appear in places where no other functions can appear out of symmetry reasons. This is something theoretical particle physicists who are evaluating scattering amplitudes using ever-more complex integrals know all too well.