# Is it a problem that you can write the logarithm of a quantity with units? [duplicate]

While working out something in thermodynamics, I encountered an equation that had a term like $\log(n_1/n_2)$, where, $n_1$ and $n_2$ are the number densities. Now of course the argument of the $\log$ is dimensionless, but I can write the same as (at least mathematically) $\log(n_1)-\log(n_2)$, in which case we have inconsistency that the arguments are not dimensionless.

So even though, its mathematically possible, in the case of physics should we restrict from using this particular expression for $\log$ wherever we have some inconsistency?

EDIT : As it has been pointed out in comments, I am also interested in understanding in cases, where $n2$ or $n1$ is small since one can't use a series expansion !!

• @DavidZ : It does partially answer my question, but I still wish to know, what can be done in cases, where $n_2$ or $n_1$ is small since one can't use a series expansion !! – user38249 Nov 4 '15 at 9:34
• Sure you can - $\log(1\pm x)$ has a perfectly well defined series expansion for $\lvert x\rvert < 1$, and otherwise you can use $\log(z) = -\log(1/z)$. But anyway, you should edit the question to make it clear what exactly you're asking that is not covered by the other question. (Think about how it will look after all these comments are removed.) – David Z Nov 4 '15 at 9:43

As you said $\log(n_1/n_2)$ is perfectly valid because even though $n_1$ and $n_2$ are not individually dimensionless but their ratio is dimensionless.

The relation $$\log(a/b) = \log(a) - \log(b)$$ is only true if $a$ and $b$ are real positive numbers. Since $n_1$ and $n_2$ are not real positive numbers (they are quantities with dimensions), you can't expand $\log(n_1/n_2)$ as $\log(n_1) - \log(n_2)$. It's similar to how you can't write $\log(-2/-5) = \log(-2) - \log(-5)$.

Let's say $n_1 = N_1 \, \text{units}$ and $n_2 = N_2 \, \text{units}$, where $N_1$ and $N_2$ are dimensionless real positive numbers. Then $n_1/n_2 = N_1/N_2$, and now

$$\log(n_1/n_2) = \log(N_1/N_2) = \log(N_1) - \log(N_2) \, .$$

This expression is both mathematically and physically valid and makes sense. :)

• Good answer. YOU might want to explicitly point out that the unit choice does not influence the value of $\log(n_1/n_2)$. – DanielSank Nov 4 '15 at 9:51
• Please have a look at the EDIT in the question !! – user38249 Nov 4 '15 at 9:51
• However small the magnitude of $n_1$ and $n_2$ are you can never write $\log(n_1/n_2) = \log(n_1) - \log(n_2)$ and can always write $\log(n_1/n_2) = \log(N_1/N_2) = \log(N_1) - \log(N_2) \, .$ – Dvij D.C. Nov 4 '15 at 10:00
• @DanielSank Thanks! Yeah, I would have wanted to mention it. Nevertheless, you have pointed it out so not editing the answer now. :P – Dvij D.C. Nov 4 '15 at 10:04

It's valid, but in physics it is usually safer that each partial term keeps some physical meaning (and physical consistency). At any point you can temporally "leave physics for maths": calculations are equivalent, at your own risk of mistake ! (e.g. if you start identifying terms with similar-looking terms coming from other sources). It might happen also that some indeterminations, infinites, complexs come on the way in partial terms, as in maths, but with little possibility to interpret them. Comprising knowledge of what is neglectable or not, linearizable or not (is the parameter "small" in $exp(-10^{-5}~ \rm{parsecs})$ ? :-) ).