4

For background, I am attempting to solve some partial differential equations using a Green's function approach:

  • I ended up with an equation to integrate, of the form $$ \int x\ln\left(\,\sqrt{{\frac{x^2}{x^2+a^2}\,}}\,\right)\mathrm{d}x $$
  • I dropped that into $\tt Wolfram\ Alpha$ which gave me the following result $$ \frac{1}{4}\left[x^{2}\ln\left(\frac{x^2}{x^2+a^2}\right) - a^{2}\ln\left(x^2+a^2 \right)\right] + \text{a constant} $$
  • I'm struggling to understand how the second term can exist.
  • $x$ and $a$ both have dimensions of length and the second term therefore involves taking a $\log$ of a number with length dimensions:
    • This means that the result is not consistent if different units are used.

Can anyone shed any light onto what is going on here ?.

Integreek
  • 8,530
  • 2
    Rewrite everything in dimensionless terms $x/a$ , this one as $$x^2 \log \frac{x^2}{x^2+a^2} -a^2 \log(\frac{ x^2+a^2}{\text{const} \ a^2 }) $$ in order not to be confronted with logs of dimensions: $\log (1 m^3) = 0 +3 \log m$ – Roland F Oct 25 '24 at 12:53
  • Thank-you - this is the answer I needed. Both enabling me to understand the alternate method and be able to apply it to more complex situations. I you can move this to an answer rather than a comment then I will accept it. – Phil Rosenberg Oct 25 '24 at 15:23

6 Answers6

6

The integration constant swallowed

$$\frac{a^2}4\log(a^2).$$

  • 1
    This should be a comment. – Integreek Nov 13 '24 at 03:53
  • 3
    @MathGuy: no, this is an answer. I make short ones. –  Nov 13 '24 at 09:17
  • @MathGuy this answers the question, I don't see why it should be a comment – Sine of the Time Nov 18 '24 at 21:08
  • 1
    @SineoftheTime I said that because it seems too short to be a good-quality answer(although it’s useful). The user should’ve elaborated more, like where that term comes from. – Integreek Nov 19 '24 at 04:21
  • @MathGuy At the moment, this is the best answer here. We have two answers that show how to do the integral but not how to resolve the units, and one that's wrong. – David K Nov 19 '24 at 05:03
  • @MathGuy OK, your latest attempt does address the actual issue. At the very end, in the part that is identical to this answer. – David K Nov 19 '24 at 05:07
  • It's not so much where the term comes from, but the fact that it ended up in the constant term in the first place rather than explicitly included in the formula in such a way that the logs are both taken on unitless quantities as they should have been. – David K Nov 19 '24 at 05:16
  • @DavidK can you please tell me what is wrong with my first answer? I have checked it and it seems to be correct. – Integreek Nov 19 '24 at 05:54
  • @MathGuy Your answer isn't wrong. The wrong answer is the incredibly long one with all the colors and such. At least I think it's wrong; it's not as clear as it might be. – David K Nov 19 '24 at 05:57
  • @DavidK oh sorry, I misunderstood your comment as: there are $2$ answers that only deal with evaluating the integral out of which only one is correct. And since Nicolas’ answer had $2$ upvotes whereas mine didn’t, I figured out maybe I had posted a wrong answer. – Integreek Nov 19 '24 at 05:58
  • @MathGuy if it's too short, it does not mean it doesn't answer the question (see this for instance). As a matter of fact, this is the best answer – Sine of the Time Nov 19 '24 at 11:33
  • @SineoftheTime so what makes an answer of good quality then? – Integreek Nov 19 '24 at 11:35
  • @MathGuy OP is asking why "the result is not consistent if different units are used" and this addresses the issue, not matter its length. See "When shouldn't I comment?"in the Help Center – Sine of the Time Nov 19 '24 at 12:13
3

Observe that $\ln\left(\frac{x^2}{x^2+a^2}\right)=2\ln(x)-\ln(x^2+a^2)$. We compute the primitive (up to an additive constant): \begin{align*} \int x\ln\left(\frac{x^2}{x^2+a^2}\right)dx&=2\int x\ln(x)dx-\int x\ln(x^2+a^2)dx\\ % &=2\left(\frac{x^2}{2}\ln(x)-\frac{1}{2}\int xdx\right)-\left(\frac{x^2}{2}\ln(x^2+a^2)-\int\frac{x^3}{x^2+a^2}dx\right)\\ % &=2\left(\frac{x^2}{2}\ln(x)-\frac{x^2}{4}\right)-\frac{x^2}{2}\ln(x^2+a^2)+\int\frac{x(x^2+a^2-a^2)}{x^2+a^2}dx\\ % &=2\left(\frac{x^2}{2}\ln(x)-\frac{x^2}{4}\right)-\frac{x^2}{2}\ln(x^2+a^2)+\int xdx-a^2\int\frac{x}{x^2+a^2}dx\\ % &=2\left(\frac{x^2}{2}\ln(x)-\frac{x^2}{4}\right)-\frac{x^2}{2}\ln(x^2+a^2)+\frac{x^2}{2}-\frac{a^2}{2}\ln(x^2+a^2). \end{align*} After some simplification, we get (up to an additive constant): \begin{align*} \int x\ln\left(\frac{x^2}{x^2+a^2}\right)dx&=x^2\ln(x)-\frac{x^2+a^2}{2}\ln(x^2+a^2). \end{align*} It remains to divide by $2$ and use $\ln\left(\frac{x^2}{x^2+a^2}\right)=2\ln(x)-\ln(x^2+a^2)$ again to obtain the desired result.

Nicolas
  • 3,949
3

$\require{cancel}$ $\require{action}$In order to inspect the integral

$$\mathcal I = \frac{1}{4} \Bigg(x^2 \ln \left(\frac{x^2}{x^2+a^2}\Bigg)-a^2 \ln \bigg(x^2+a^2 \bigg)\right) + \text{constant},$$

where $x$ and $a$ both have dimension of length, we rewrite the expression as $$\mathcal I = \frac{1}{4} \Bigg([x]^2 \ln \left(\frac{[x]^2}{[x]^2+[a]^2}\Bigg)-[a]^2 \ln \bigg([x]^2+[a]^2 \bigg)\right) + \text{constant},\tag{1}\label{eq:1}$$ where we consider $[x] = x \, \text{m}$ and $[a] = a \, \text{m}$, being $[x]$ and $[a]$ the dimensional quantities, $x$ and $a$ two dimensionless, real quantities $(x, a \in \mathbb R)$, $\text{m}$ the SI unit of measurement of length (meters).

Now, we write $\eqref{eq:1}$ as $$\underbrace{-\frac{1}{4} [x]^2 \ln \Bigg(\frac{[x]^2+[a]^2}{[x]^2}\Bigg)}_{\displaystyle 1^{\text{st}} \, \text{addend}} \qquad \underbrace{- \,\, \frac{1}{4}[a]^2 \ln \bigg([x]^2+[a]^2 \bigg)}_{\displaystyle 2^{\text{nd}} \, \text{addend}} \qquad \underbrace{+ \,\, \text{constant}}_{\displaystyle 3^{\text{rd}} \, \text{addend}}$$ multiplying by $\dfrac{1}{4}$ the expression under the external round brackets so that:

$$\begin{align} -\frac{1}{4} [x]^2 \ln \Bigg(\frac{[x]^2+[a]^2}{[x]^2}\Bigg) \quad &\text{is the} \,\, 1^\text{st} \, \text{addend} \tag{1.1} \label{eq:1.1}\\ - \frac{1}{4}[a]^2 \ln \bigg([x]^2+[a]^2 \bigg) \quad &\text{is the} \,\, 2^\text{nd} \, \text{addend} \tag{1.2} \label{eq:1.2}\\ \text{constant} \quad &\text{is the} \,\, 3^\text{rd} \, \text{addend}. \tag{1.3} \label{eq:1.3} \end{align}$$

We will dissect the concept of logarithm of a dimensional quantity through a constructive approach, determining some constraints so that it can be well-defined and applying it to the specific case of the post.

$1^{\text{st}}$ constraint: Construction of a space $\mathcal S$ of dimensional quantities in which addition is only defined between quantities having the same unit of measurement.

Let $\mathcal S$ be the space of dimensional quantities to which two dimensional quantities $[\alpha], [\beta]$ belong, being $[\alpha] = \alpha \, \color{red}{\text{unit}}$ and $[\beta] = \beta \, \color{blue}{\text{unit}}$, with $\alpha$ and $\beta$ two dimensionless, real quantities $(\alpha, \beta \in \mathbb R)$, $\color{red}{\text{unit}}$ and $\color{blue}{\text{unit}}$ two SI units of measurement.

  1. The multiplication $\color{Green}{\boldsymbol \cdot}$ is defined as usual: $$[\alpha] \, {\color{Green}{\boldsymbol \cdot}} \, [\beta] := [\alpha] \cdot [\beta] = \alpha \, \color{red}{\text{unit}} \cdot \beta \, \color{blue}{\text{unit}} = (\alpha \cdot \beta) \, (\color{red}{\text{unit}} \cdot \color{blue}{\text{unit}}) \qquad \text{for} \quad [\alpha], [\beta] \in \mathcal S$$ and the result is a dimensional quantity.

  2. The addition $\color{GoldenRod}{\boldsymbol{+}}$ is not defined as usual. From a physics standpoint, it is not possible to add up two quantities $[\alpha], [\beta] \in \mathcal S$ having different SI units of measurement (e.g. metres $\text{m}$ and seconds $\text{s}$, or kilograms $\text{kg}$ and kelvins $\text{K}$, etc...). So, addition of dimensional quantities $[\alpha], [\beta]$ is only defined if they have the same unit of measurement, i.e. if $\color{red}{\text{unit}} \equiv \color{blue}{\text{unit}} = \color{GoldenRod}{\text{unit}}$. This happens when the dimensional quantities differ only by their dimensionless quantities, i.e. the ratio between two dimensional quantities having the same unit of measurement reduces to the ratio between their two dimensionless quantities and is equal to a real scalar $\lambda \in \mathbb R$. Then $$[\alpha] \color{GoldenRod}{\boldsymbol{+}} [\beta] := [\alpha] + [\beta] \,\, (\text{i.e., the addition is defined}) \boldsymbol{\color{Violet}\iff} \frac{[\alpha]}{[\beta]} = \frac{\alpha \, \cancel{\color{GoldenRod}{\text{unit}}}}{\beta \, \bcancel{\color{GoldenRod}{\text{unit}}}} = \frac{\alpha}{\beta} = \lambda \in \mathbb R, \tag{$\spadesuit$} \label{spade}$$ and we have $$[\alpha] + [\beta] = \alpha \, \color{GoldenRod}{\text{unit}} + \beta \, \color{GoldenRod}{\text{unit}} = (\alpha + \beta) \, \color{GoldenRod}{\text{unit}}.$$

The division $\dfrac{[\alpha]}{[\beta]}$ between the two quantities $[\alpha]$ and $[\beta]$ is defined as $$\frac{[\alpha]}{[\beta]} := [\alpha] \cdot \frac{1}{[\beta]},$$ and since multiplication is well-defined, division between two dimensional quantities is also well-defined in $\mathcal S$.

So, since $\exists \, \lambda \in \mathbb R : \dfrac{[\alpha]}{[\beta]} = \lambda$ for $[\alpha], [\beta] \in \mathcal S$ having the same unit of measurement, the scalar $\lambda$ we can multiply by is an element of $\mathbb R$, so the space of dimensional quantities $\mathcal S$ is, by construction, a space over $\mathbb R$.
So, by definition, the space of dimensional quantities has the set of real numbers as a subset, which implies $\mathbb R \subset \mathcal S$.

This implies the following cases:

  • $\text{Case A)}$: $\, \alpha, \beta \in \mathbb R$.
    For two real values $\alpha, \beta \in \mathbb R$, all operations defined in $\mathbb R$ are trivially well-defined.

  • $\text{Case B)}$: $\, [\alpha], [\beta] \in \mathcal S \supset \mathbb R$

  1. Even if $[\alpha], [\beta] \in \mathcal S \supset \mathbb R$, for non-dimensional quantities of the type $\dfrac{[\alpha]}{[\beta]} = \lambda \in \mathbb R$ belonging to the set of real numbers, operations between functions defined in $\mathbb R$ are well-defined.

Since operations between functions defined in $\mathbb R$ include the logarithm, then the logarithm $$\ln \left(\frac{[\alpha]}{[\beta]}\right) = \ln \left(\frac{\alpha \, \cancel{\color{GoldenRod}{\text{unit}}}}{\beta \, \bcancel{\color{GoldenRod}{\text{unit}}}}\right) = \ln \left(\frac{\alpha}{\beta}\right) = \ln \left(\underbrace{\lambda}_{\displaystyle \in \mathbb R}\right) \in \mathbb R \implies \ln \left(\frac{[\alpha]}{[\beta]}\right) = \texttt{constant}$$ is well-defined for the dimensionless ratio $\dfrac{[\alpha]}{[\beta]}= \dfrac{\alpha}{\beta}$.

  1. We define a space $\mathcal V$ in which the operations defined in $\mathcal S$ are well-defined. Being $\mathcal V$ the space of operations in $\mathcal S$, it will be a subspace of $\mathcal S$. Since $\mathbb R$ is a subspace of $\mathcal S$, and since $\mathcal V$ also includes the operations in $\mathcal S$ not defined in $\mathbb R$, then $\mathbb R$ will be a subspace of $\mathcal V$, i.e. $\mathcal V$ has as its subspace the set of real numbers.
    Addition in $\mathcal S$ is only defined between dimensional quantities having the same unit, but the order does not matter. Thus, we require that in $\mathcal S$ the commutative property for addition $\color{GoldenRod}{\boldsymbol{+}}$ holds, i.e. that $\mathcal S$ is a commutative (or Abelian) group under addition $\color{GoldenRod}{\boldsymbol{+}}$. Therefore: $$[\alpha] \color{GoldenRod}{\boldsymbol{+}} [\beta] = [\beta] \color{GoldenRod}{\boldsymbol{+}} [\alpha] \qquad \text{for some} \,\, [\alpha], [\beta] \in \mathcal S,$$ being $\color{GoldenRod}{\boldsymbol{+}}$ the addition as defined in $\mathcal S$.
    Consequently, we also require that $\mathcal V$ is a commutative group under addition $\color{GoldenRod}{\boldsymbol{+}}$, i.e. $$f([\alpha]) \color{GoldenRod}{\boldsymbol{+}} f([\beta]) = f([\beta]) \color{GoldenRod}{\boldsymbol{+}} f([\alpha])\qquad \text{for some} \,\, [\alpha], [\beta] \in \mathcal S,$$ being $f: \mathcal S \to \mathcal V$ a function and being $\color{GoldenRod}{\boldsymbol{+}}$ the addition as defined in $\mathcal S$.
    Being $\mathcal V$ characterised, all operations defined in $\mathbb R$ are well-defined in $\mathcal S$, always forcing the requirement that the addends of an addition $\color{GoldenRod}{\boldsymbol{+}}$ have the same unit.

Now, we can apply these two subcases to the specific computation of the OP.

$*$ $\eqref{eq:1.1} \Rightarrow$ We can write $\eqref{eq:1.1}$ as: $$\begin{align} -\frac{1}{4} [x]^2 \ln \Bigg(\frac{[x]^2+[a]^2}{[x]^2}\Bigg) &= - \frac{1}{4} [x]^2 \ln \Bigg(\frac{[x]^2}{[x]^2}+\frac{[a]^2}{[x]^2}\Bigg) \qquad &\text{(distributing $[x]^2$ at the denominator)}\\ &= - \frac{1}{4} [x]^2 \ln \Bigg(\frac{\cancel{[x]^2}}{\bcancel{[x]^2}}+\frac{[a]^2}{[x]^2}\Bigg) \qquad &\text{(canceling $[x]^2$ at numerator and denominator)} \\ &= - \frac{1}{4} [x]^2 \ln \Bigg(1+\frac{[a]^2}{[x]^2}\Bigg) \qquad &\text{(rewriting the simplified expression)} \\ &= - \frac{1}{4} [x]^2 \ln \Bigg[1+ \left(\frac{[a]}{[x]}\right)^2\Bigg] \qquad &\text{(rewriting $\left(\frac{[a]^2}{[x]^2}\right)$ as $\left(\frac{[a]}{[x]}\right)^2$)} \end{align}$$ so $$1^\text{st} \, \text{addend} = - \frac{1}{4} [x]^2 \ln \Bigg[1+ \left(\frac{[a]}{[x]}\right)^2\Bigg]. \tag{1.1$^{\dagger}$}\label{eq:1.1dagger}$$

  • $- \dfrac{1}{4}$ is a real number. $\implies \boxed{- \dfrac{1}{4} \in \mathbb R}$.
  • Since $[x] \in \mathcal S$, the factor $[x]^2$ belongs to $\mathcal V \subset \mathcal S$, the space of operations in $\mathcal S$, being $x^2$ an exponentiation operation. $\implies \boxed{[x]^2 \in \mathcal V \subset \mathcal S}$.
  • $1$ belongs to the set of real numbers, so $1 \in \mathbb R$; since $[a]$ and $[x]$ have the same unit of measurement, we know that $\dfrac{[a]}{[x]} \in \mathbb R$, so $\Bigg(\dfrac{[a]}{[x]}\Bigg)^2 \in \mathbb R$. Finally, $1+\Bigg(\dfrac{[a]}{[x]}\Bigg)^2 \in \mathbb R$ because it is a sum of two real values. So, since the natural logarithm of a real quantity is a real value itself, ultimately: $\implies \boxed{\ln \Bigg[\underbrace{1+ \left(\dfrac{[a]}{[x]}\right)^2}_{\displaystyle \in \mathbb R}\Bigg] \in \mathbb R}$,

We have: $$1^\text{st} \, \text{addend} = \underbrace{\toggle{\bbox[10pt,orange]{\vphantom{\frac{0}{0}}}}{- \frac{1}{4}}\endtoggle}_{\displaystyle \in \mathbb R} \qquad \underbrace{\toggle{\bbox[10pt, cyan]{}}{[x]^2}\endtoggle}_{\displaystyle \in \mathcal V \subset S} \qquad \underbrace{\toggle{\bbox[18pt, Red]{\hspace{2cm}}}{\ln \Bigg[1+ \left(\frac{[a]}{[x]}\right)^2\Bigg]}\endtoggle}_{\displaystyle \in \mathbb R}\, .$$

$**$ $\eqref{eq:1.2} \Rightarrow$ The $2^\text{nd} \, \text{addend}$ contains a logarithm of a sum of two dimensional quantities, $\ln \Bigg([x]^2 + [a]^2 \Bigg)$. We know that the addition $\color{GoldenRod}{\boldsymbol{+}}$ is defined in $\mathcal S$ if and only if the following condition holds $$\exists \, \kappa \in \mathbb R : \frac{\color{Green}{\text{dimensional quantity}}}{\color{Purple}{\text{dimensional quantity}}} = \kappa,$$ as per $\eqref{spade}$.
Since the dimensional quantities are $[x]$ and $[a]$, a distinction must be made between two cases. $\text{1)} \star \qquad \color{Green}{\text{dimensional quantity}} = [a] \quad \text{and} \quad \color{Purple}{\text{dimensional quantity}} = [x]$.
The fundamental condition is: $$\exists \, \kappa \in \mathbb R : \frac{[a]}{[x]} = \kappa \tag{$\triangle$}\label{eq:triangle}$$ or $$[a] = \kappa \, [x] \qquad \kappa \in \mathbb R. \tag{$\triangle \triangle$}\label{eq:triangletriangle}$$ The $2^{\text{nd}} \, \text{addend}$ is: $$\begin{align} - \frac{1}{4}[a]^2 \ln \bigg([x]^2+[a]^2 \bigg) &= - \frac{1}{4}[a]^2 \ln \bigg([x]^2+(\kappa [x])^2 \bigg) \qquad &\text{(writing $[a]$ as $\kappa [x]$, as per $\eqref{eq:triangletriangle}$)} \\ &= - \frac{1}{4}[a]^2 \ln \bigg([x]^2+ \kappa^2 [x]^2 \bigg) \qquad &\text{(writing $(\kappa [x])^2$ as $\kappa^2 [x]^2$)} \\ &= - \frac{1}{4}[a]^2 \ln \bigg([x]^2 \cdot (1+ \kappa^2) \bigg) \qquad &\text{(factoring $[x]^2$ out)}. \end{align}$$ Now, we exploit the following

$\large \color{Red}{\text{Fundamental property.}}$ Uniqueness of the logarithm to split out multiplicative factors into additive terms, according to $$\ln(\gamma \cdot \delta) := \ln (\gamma) + \ln(\delta) \qquad \text{for} \quad \gamma, \delta \in \mathbb R.$$

Applying the previous property to the last form of the $2^{\text{nd}} \, \text{addend}$ (the one obtained by factoring $[x]^2$ out), we have:

$$\begin{align} - \frac{1}{4}[a]^2 \ln \bigg([x]^2+[a]^2 \bigg) &= - \frac{1}{4}[a]^2 \ln \bigg([x]^2 \cdot (1+ \kappa^2) \bigg) \qquad &\text{(rewriting the expression)} \\ &= - \frac{1}{4}[a]^2 \left[\ln ([x]^2) + \ln (1+\kappa^2)\right] \qquad &\text{(applying the fundamental property of logarithm)} \\ &= - \frac{1}{4}[a]^2 \ln [x]^2 - \frac{1}{4}[a]^2 \ln (1+\kappa^2) \qquad &\text{(multiplying the expression into square brackets by $-\dfrac{1}{4}[a]^2$)} \\ &= - \frac{1}{4}[a]^2 \ln [x]^2 - \frac{1}{4}[a]^2 \ln \bigg[1+\left(\frac{[a]}{[x]}\right)^2\bigg] \qquad &\text{(substituting $\kappa = \dfrac{[a]}{[x]}$, as per $\eqref{eq:triangle}$)}, \end{align}$$ so $$2^\text{nd} \, \text{addend}, \star = \underbrace{- \frac{1}{4}[a]^2 \ln [x]^2}_{\displaystyle 1^\text{st} \, \text{term}} \qquad \underbrace{- \, \frac{1}{4}[a]^2 \ln \bigg[1+\left(\frac{[a]}{[x]}\right)^2\bigg]}_{\displaystyle 2^\text{nd} \, \text{term}}\tag{1.2$^{\dagger}$}\label{eq:1.2dagger}.$$

The $1^\text{st} \, \text{term}$ of the $2^\text{nd} \, \text{addend}, \star$ is $- \dfrac{1}{4}[a]^2 \ln [x]^2$:

  • $- \dfrac{1}{4}$ is a real number. $\implies \boxed{- \dfrac{1}{4} \in \mathbb R}$.
  • Since $[x]\in \mathcal S$, the factor $[a]^2$ belongs to $\mathcal V \subset \mathcal S$, the space of operations in $\mathcal S$, being $a^2$ an exponentiation operation. $\implies \boxed{[a]^2 \in \mathcal V \subset \mathcal S}$.
  • Since $[x]\in \mathcal S$, the factor $[x]^2$ belongs to $\mathcal V \subset \mathcal S$, the space of operations in $\mathcal S$, being $x^2$ an exponentiation operation. Since $[x]^2 \in \mathcal V \subset \mathcal S$, and since the natural logarithm of a dimensional quantity is a function belonging to the space $\mathcal V$ of operations in $\mathcal S$, we have that $\ln ([x]^2) \in \mathcal V \subset \mathcal S$. $\implies \boxed{\ln \bigg[\underbrace{[x]^2}_{\displaystyle \in \mathcal V} \bigg] \in \mathcal V \subset \mathcal S}$.

The $2^\text{nd} \, \text{term}$ of the $2^\text{nd} \, \text{addend}, \star$ is $-\dfrac{1}{4}[a]^2 \ln \bigg(1+\left(\dfrac{[a]}{[x]}\right)^2\bigg)$:

  • $- \dfrac{1}{4}$ is a real number. $\implies \boxed{- \dfrac{1}{4} \in \mathbb R}$.
  • Since $[a], \in \mathcal S$, the factor $[a]^2$ belongs to $\mathcal V \subset \mathcal S$, the space of operations in $\mathcal S$, being $x^2$ an exponentiation operation. $\implies \boxed{[a]^2 \in \mathcal V \subset \mathcal S}$.
  • $1$ belongs to the set of real numbers, so $1 \in \mathbb R$; since $[a]$ and $[x]$ have the same unit of measurement, we know that $\dfrac{[a]}{[x]} \in \mathbb R$, so $\Bigg(\dfrac{[a]}{[x]}\Bigg)^2 \in \mathbb R$. Finally, $1+\Bigg(\dfrac{[a]}{[x]}\Bigg)^2 \in \mathbb R$ because it is a sum of two real values. So, since the natural logarithm of a real quantity is a real value itself, ultimately: $\implies \boxed{\ln \Bigg[\underbrace{1+ \left(\dfrac{[a]}{[x]}\right)^2}_{\displaystyle \in \mathbb R}\Bigg] \in \mathbb R}$.

We have: $$2^\text{nd} \text{addend}, \star = \overbrace{\underbrace{\toggle{\bbox[10pt,orange]{\vphantom{\frac{0}{0}}}}{-\frac{1}{4}}\endtoggle}_{\displaystyle \in \mathbb R} \qquad \underbrace{\toggle{\bbox[10pt,cyan]{}}{[a]^2} \endtoggle}_{\displaystyle \in \mathcal V \subset \mathcal S} \qquad \underbrace{\toggle{\bbox[10pt,brown]{\hspace{2pt}}}{\ln ([x]^2)} \endtoggle}_{\displaystyle \in \mathcal V \subset \mathcal S}}^{\displaystyle 1^{\text{st}} \, \text{term}} \hspace{2cm} \overbrace{\underbrace{\toggle{\bbox[10pt,orange]{\vphantom{\frac{0}{0}}}}{-\frac{1}{4}}\endtoggle}_{\displaystyle \in \mathbb R} \qquad \underbrace{\toggle{\bbox[10pt, cyan]{}}{[a]^2}\endtoggle}_{\displaystyle \in \mathcal V \subset S} \qquad \underbrace{\toggle{\bbox[18pt, Red]{\hspace{2cm}}}{\ln \Bigg[1+ \left(\frac{[a]}{[x]}\right)^2\Bigg]}\endtoggle}_{\displaystyle \in \mathbb R}}^{\displaystyle 2^{\text{nd}} \, \text{term}}\, .$$

$\text{2)} \star \star \qquad \color{Green}{\text{dimensional quantity}} = [x] \quad \text{and} \quad \color{Purple}{\text{dimensional quantity}} = [a]$.
The fundamental condition is: $$\exists \, \kappa' \in \mathbb R : \frac{[x]}{[a]} = \kappa' \tag{$\triangle'$}\label{eq:triangle'}$$ or $$[x] = \kappa' \, [a] \qquad \kappa' \in \mathbb R. \tag{$\triangle \triangle'$}\label{eq:triangletriangle'}$$ The $2^{\text{nd}} \, \text{addend}$ is: $$\begin{align} - \frac{1}{4}[a]^2 \ln \bigg([x]^2+[a]^2 \bigg) &= - \frac{1}{4}[a]^2 \ln \bigg((\kappa' [a])^2 + [a]^2\bigg) \qquad &\text{(writing $[x]$ as $\kappa' [a]$, as per $\eqref{eq:triangletriangle'}$)} \\ &= - \frac{1}{4}[a]^2 \ln \bigg(\kappa'^2 [a]^2 + [a]^2 \bigg) \qquad &\text{(writing $(\kappa' [a])^2$ as $\kappa'^2 [a]^2$)} \\ &= - \frac{1}{4}[a]^2 \ln \bigg([a]^2 \cdot (\kappa'^2+1) \bigg) \qquad &\text{(factoring $[a]^2$ out)}. \end{align}$$ Now, we exploit the following

$\large \color{Red}{\text{Fundamental property.}}$ Uniqueness of the logarithm to split out multiplicative factors into additive terms, according to $$\ln(\gamma' \cdot \delta') := \ln (\gamma') + \ln(\delta') \qquad \text{for} \quad \gamma', \delta' \in \mathbb R.$$

Applying the previous property to the last form of the $2^{\text{nd}} \, \text{addend}$ (the one obtained by factoring $[a]^2$ out), we have:

$$\begin{align} - \frac{1}{4}[a]^2 \ln \bigg([x]^2+[a]^2 \bigg) &= - \frac{1}{4}[a]^2 \ln \bigg([a]^2 \cdot (1+ \kappa'^2) \bigg) \qquad &\text{(rewriting the expression applying the commutative property)} \\ &= - \frac{1}{4}[a]^2 \left[\ln ([a]^2) + \ln (1+\kappa'^2)\right] \qquad &\text{(applying the fundamental property of logarithm)} \\ &= - \frac{1}{4}[a]^2 \ln [a]^2 - \frac{1}{4}[a]^2 \ln (1+\kappa'^2) \qquad &\text{(multiplying the expression into square brackets by $-\dfrac{1}{4}[a]^2$)} \\ &= - \frac{1}{4}[a]^2 \ln [x]^2 - \frac{1}{4}[a]^2 \ln \bigg(1+\left(\frac{[x]}{[a]}\right)^2\bigg) \qquad &\text{(substituting $\kappa' = \dfrac{[x]}{[a]}$, as per $\eqref{eq:triangle'}$)}, \end{align}$$ so $$2^\text{nd} \, \text{addend}, \star \star = \underbrace{- \frac{1}{4}[a]^2 \ln [a]^2}_{\displaystyle 1^\text{st} \, \text{term}} \qquad \underbrace{- \, \frac{1}{4}[a]^2 \ln \bigg(1+\left(\frac{[x]}{[a]}\right)^2\bigg)}_{\displaystyle 2^\text{nd} \, \text{term}}\tag{1.2$^{\dagger'}$}\label{eq:1.2dagger'}.$$

The $1^\text{st} \, \text{term}$ of the $2^\text{nd} \, \text{addend}, \star \star$ is $- \dfrac{1}{4}[a]^2 \ln [a]^2$:

  • $- \dfrac{1}{4}$ is a real number. $\implies \boxed{- \dfrac{1}{4} \in \mathbb R}$.
  • Since $[a]\in \mathcal S$, the factor $[a]^2$ belongs to $\mathcal V \subset \mathcal S$, the space of operations in $\mathcal S$, being $a^2$ an exponentiation operation. $\implies \boxed{[a]^2 \in \mathcal V \subset \mathcal S}$.
  • Since $[a]^2 \in \mathcal V \subset \mathcal S$, and since the natural logarithm of a dimensional quantity is a function belonging to the space $\mathcal V$ of operations in $\mathcal S$, we have that $\ln ([a]^2) \in \mathcal V \subset \mathcal S$. $\implies \boxed{\ln \bigg[\underbrace{[a]^2}_{\displaystyle \in \mathcal V} \bigg] \in \mathcal V \subset \mathcal S}$.

The $2^\text{nd} \, \text{term}$ of the $2^\text{nd} \, \text{addend}, \star$ is $-\dfrac{1}{4}[a]^2 \ln \bigg(1+\left(\dfrac{[x]}{[a]}\right)^2\bigg)$:

  • $- \dfrac{1}{4}$ is a real number. $\implies \boxed{- \dfrac{1}{4} \in \mathbb R}$.
  • Since $[a] \in \mathcal S$, the factor $[a]^2$ belongs to $\mathcal V \subset \mathcal S$, the space of operations in $\mathcal S$, being $x^2$ an exponentiation operation. $\implies \boxed{[a]^2 \in \mathcal V \subset \mathcal S}$.
  • $1$ belongs to the set of real numbers, so $1 \in \mathbb R$; since $[x]$ and $[a]$ have the same unit of measurement, we know that $\dfrac{[x]}{[a]} \in \mathbb R$, so $\Bigg(\dfrac{[x]}{[a]}\Bigg)^2 \in \mathbb R$. Finally, $1+\Bigg(\dfrac{[x]}{[a]}\Bigg)^2 \in \mathbb R$ because it is a sum of two real values. So, since the natural logarithm of a real quantity is a real value itself, ultimately: $\implies \boxed{\ln \Bigg[\underbrace{1+ \left(\dfrac{[x]}{[a]}\right)^2}_{\displaystyle \in \mathbb R}\Bigg] \in \mathbb R}$.

We have: $$2^\text{nd} \text{addend}, \star \star = \overbrace{\underbrace{\toggle{\bbox[10pt,orange]{\vphantom{\frac{0}{0}}}}{-\frac{1}{4}}\endtoggle}_{\displaystyle \in \mathbb R} \qquad \underbrace{\toggle{\bbox[10pt,cyan]{}}{[a]^2} \endtoggle}_{\displaystyle \in \mathcal V \subset \mathcal S} \qquad \underbrace{\toggle{\bbox[10pt,brown]{\hspace{2pt}}}{\ln ([a]^2)} \endtoggle}_{\displaystyle \in \mathcal V \subset \mathcal S}}^{\displaystyle 1^{\text{st}} \, \text{term}} \hspace{1.8cm} \overbrace{\underbrace{\toggle{\bbox[10pt,orange]{\vphantom{\frac{0}{0}}}}{-\frac{1}{4}}\endtoggle}_{\displaystyle \in \mathbb R} \qquad \underbrace{\toggle{\bbox[10pt, cyan]{}}{[a]^2}\endtoggle}_{\displaystyle \in \mathcal V \subset S} \qquad \underbrace{\toggle{\bbox[18pt, Red]{\hspace{2cm}}}{\ln \Bigg[1+ \left(\frac{[x]}{[a]}\right)^2\Bigg]}\endtoggle}_{\displaystyle \in \mathbb R}}^{\displaystyle 2^{\text{nd}} \, \text{term}}\, .$$

It can be seen that both $2^\text{nd} \text{addend}, \star$ and $2^\text{nd} \text{addend}, \star \star$ are not well-defined because it is not consistent: the first term is a product of a real scalar with two quantities belonging to the space $\mathcal V$, while the second term is the product of a quantity belonging to the space $\mathcal V$ with two real values.

$***$ $\eqref{eq:1.3} \Rightarrow$ The $3^\text{rd} \, \text{addend}$ is a constant, which forces the following constraint:
$2^\text{nd} \, \text{constraint}$: A constant must be some fixed representative, not dependent on variable quantities.

Since we have distinguished two cases for the $2^\text{nd} \, \text{addend}$, the original expression, formed by $1^\text{st} \, \text{addend}$, $2^\text{nd} \, \text{addend}$, $3^\text{rd} \, \text{addend}$ will be distinguished into two different cases.

$\text{1)}$ Adding up $\eqref{eq:1.1dagger}$, $\eqref{eq:1.2dagger}$, $\eqref{eq:1.3}$:

$$\overbrace{\underbrace{- \frac{1}{4}}_{\displaystyle \in \mathbb R} \,\, \underbrace{[x]^2}_{\displaystyle \in \mathcal V} \quad \underbrace{\ln \Bigg[1+ \left(\frac{[a]}{[x]}\right)^2\Bigg]}_{\displaystyle \in \mathbb R}}^{\displaystyle 1^\text{st} \, \text{addend}} \qquad \overbrace{\color{brown}{\underbrace{- \frac{1}{4}}_{\displaystyle \in \mathbb R} \,\, \underbrace{[a]^2}_{\displaystyle \in \mathcal V} \,\, \underbrace{\ln [x]^2}_{\displaystyle \in \mathcal V}}}^{\displaystyle 1^\text{st} \, \text{term}, \star} \qquad \overbrace{\underbrace{- \frac{1}{4}}_{\displaystyle \in \mathbb R} \,\, \underbrace{[a]^2}_{\displaystyle \in \mathcal V} \quad \underbrace{\ln \Bigg[1+\left(\frac{[a]}{[x]}\right)^2\Bigg]}_{\displaystyle \in \mathbb R}}^{\displaystyle 2^\text{nd} \, \text{term}, \star} \qquad \overbrace{\color{brown}{+ \, \text{constant}}}^{\displaystyle 3^\text{rd} \, \text{addend}}.$$

Note that $1^\text{st} \, \text{addend}$ and $1^\text{st} \, \text{term}, \star$ (of the $2^\text{nd} \, \text{addend}$) are both of the same form: they are composed of a product of two real values and a dimensional quantity belonging to the space of operations in $\mathcal S$. The $2^\text{nd} \, \text{term}, \star$ is different from $1^\text{st} \, \text{addend}$ and $1^\text{st} \, \text{term}, \star$ because it is composed of the product of a real scalar and two dimensional quantities belonging to the space of operations in $\mathcal S$. The third addend is the constant, about which nothing is known.

Thus, to make the expression consistent, the $2^\text{nd} \, \text{term}, \star$, different from the others, is merged with the constant by imposing that they sum to a constant $K$ that must be the product of two real values and a dimensional quantity belonging to the space $\mathcal V$. In this way, all terms will be given by the product between two real values and a dimensional quantity belonging to $\mathcal V$, so they do not affect the consistency of the result. So:

$$\begin{align} - \frac{1}{4} [a]^2 \ln [x]^2 &+ \text{constant} = K, \\ \quad \text{with} \quad K = \varepsilon \, f([q]) \, \varphi, \quad \varepsilon, \varphi &\in \mathbb R \quad \text{and} \quad f([q]) \in \mathcal V \subset S \\ &\Big \Updownarrow \\ \text{constant} = \frac{1}{4} &[a]^2 \ln [x]^2 + K, \\ \quad \text{with} \quad K = \varepsilon \, f([q]) \, \varphi, \quad \varepsilon, \varphi &\in \mathbb R \quad \text{and} \quad f([q]) \in \mathcal V \subset S. \end{align}$$

Even assuming that $q$ is a fixed representative, this implies that the constant depends on $x$, which, however, is the variable of integration and therefore varies incrementally. This contradicts the $2^{\text{nd}} \, \text{constraint}$, according to which the constant must be a fixed representative not dependent on variables. Therefore, this case is to be abandoned. Let us move on to the other case.

$\text{1)}$ Adding up $\eqref{eq:1.1dagger}$, $\eqref{eq:1.2dagger'}$, $\eqref{eq:1.3}$:

$$\overbrace{\underbrace{- \frac{1}{4}}_{\displaystyle \in \mathbb R} \,\, \underbrace{[x]^2}_{\displaystyle \in \mathcal V} \quad \underbrace{\ln \Bigg[1+ \left(\frac{[a]}{[x]}\right)^2\Bigg]}_{\displaystyle \in \mathbb R}}^{\displaystyle 1^\text{st} \, \text{addend}} \qquad \overbrace{\color{brown}{\underbrace{- \frac{1}{4}}_{\displaystyle \in \mathbb R} \,\, \underbrace{[a]^2}_{\displaystyle \in \mathcal V} \,\, \underbrace{\ln [a]^2}_{\displaystyle \in \mathcal V}}}^{\displaystyle 1^\text{st} \, \text{term}, \star \star} \qquad \overbrace{\underbrace{- \frac{1}{4}}_{\displaystyle \in \mathbb R} \,\, \underbrace{[a]^2}_{\displaystyle \in \mathcal V} \quad \underbrace{\ln \Bigg[1+\left(\frac{[x]}{[a]}\right)^2\Bigg]}_{\displaystyle \in \mathbb R}}^{\displaystyle 2^\text{nd} \, \text{term}, \star \star} \qquad \overbrace{\color{brown}{+ \, \text{constant}}}^{\displaystyle 3^\text{rd} \, \text{addend}}.$$

Note that $1^\text{st} \, \text{addend}$ and $1^\text{st} \, \text{term}, \star$ (of the $2^\text{nd} \, \text{addend}$) are both of the same form: they are composed of a product of two real values and a dimensional quantity belonging to the space of operations in $\mathcal S$. The $2^\text{nd} \, \text{term}, \star \star$ is different from $1^\text{st} \, \text{addend}$ and $1^\text{st} \, \text{term}, \star \star$ because it is composed of the product of a real scalar and two dimensional quantities belonging to the space of operations in $\mathcal S$. The third addend is the constant, about which nothing is known.

Thus, to make the expression consistent, the $2^\text{nd} \, \text{term}, \star \star$, different from the others, is merged with the constant by imposing that they sum to a constant $K$ that must be the product of two real values and a dimensional quantity belonging to the space $\mathcal V$. In this way, all terms will be given by the product between two real values and a dimensional quantity belonging to $\mathcal V$, so they do not affect the consistency of the result. So:

$$\begin{align} - \frac{1}{4} [a]^2 \ln [a]^2 &+ \text{constant} = K', \\ \quad \text{with} \quad K' = \varepsilon' \, f([q']) \, \varphi', \quad &\varepsilon', \varphi' \in \mathbb R \quad \text{and} \quad f([q']) \in \mathcal V \subset S \\ &\Big \Updownarrow \\ \text{constant} = \frac{1}{4} &[a]^2 \ln [a]^2 + K', \\ \quad \text{with} \quad K' = \varepsilon' \, f([q']) \, \varphi', \quad &\varepsilon', \varphi' \in \mathbb R \quad \text{and} \quad f([q']) \in \mathcal V \subset S. \end{align}$$

Assuming that $q$ is a fixed representative, this implies that the constant depends on $a$ and on $\varepsilon, \varphi, q$, which are fixed representative. This is in agreement with the $2^{\text{nd}} \, \text{constraint}$. So,

$$\bbox[10px,#f4f4e8, border:5px outset #222390]{\text{constant} = \frac{1}{4} [a]^2 \ln [a]^2 + K'},$$ with $$\begin{align} &[a] = a \, \text{m}, \, a \in \mathbb R \\ &K' = \varepsilon' \, f([q']) \, \varphi', \quad &\varepsilon', \varphi' \in \mathbb R \quad \text{and} \quad f([q']) \in \mathcal V \subset S. \end{align}$$ and there are infinite values of $K'$ that make the constant such that the final result is dimensionally consistent.

Note. The most immediate choice is to set $\varepsilon' = \dfrac{1}{4}$, $f([q']) = [a]^2$ and $\varphi' = \ln \eta, \quad \eta \in \mathbb R^{+}$ (since the argument of the logarithm must always be positive). We would have

$$\begin{align} \text{constant} &= \frac{1}{4} [a]^2 \ln [a]^2 + \frac{1}{4} [a]^2 \ln \eta \\ &= \frac{1}{4} [a]^2 \left(\ln [a]^2 + \ln \eta \right) \quad \eta \in \mathbb R^{+} \qquad &\text{(factoring $\dfrac{1}{4} [a]^2$ out)} \\ &= \frac{1}{4} [a]^2 \ln \left(\eta [a]^2 \right) \quad \eta \in \mathbb R^{+} \qquad &\text{(applying fundamental property of logarithm in reverse)}. \end{align}$$

M. A.
  • 1,774
  • I cannot imagine that it really takes this much effort just to correctly deal with the units of $x$ and $a$. Why is this answer so long? And for all its length, it doesn't even explain itself adequately. How did you deduce the "$2$nd constraint"? If I parsed its statement correctly, it's just wrong. This is an indefinite integral and its constant of integration cannot be determined. – David K Nov 19 '24 at 05:00
  • 1
    @DavidK My answer is so long because I like to explain each step and go in depth. It is just my choice. The $2^{\text{nd}} , \text{constraint}$ is just a rule of thumb, I mean that a constant should be a fixed representative not dependent on $x$, which is the variable of integration. – M. A. Nov 19 '24 at 06:30
  • I still have trouble following the answer all the way through, but at least the conclusion seems to be good enough now. – David K Nov 19 '24 at 13:58
3

When you do an integral, the standard solution methods assume everything in the integral is unitless. This works out OK most of the time. This integral is one of the exceptions.

A quick fix is to simply change the constant of integration to enable you to take logarithms of unitless values in the result. From the solution $$ \int x\ln\left(\sqrt{{\frac{x^2}{x^2+a^2}}}\right)\mathrm dx = \frac{1}{4}\left[x^{2}\ln\left(\frac{x^2}{x^2+a^2}\right) - a^{2}\ln\left(x^2+a^2 \right)\right] + C, $$ where $C$ is an arbitrary constant and the variables $x$ and $a$ have been treated as unitless, let $C = \frac12 a^2 \ln(a) + C'$. Then the solution becomes \begin{multline} \int x\ln\left(\sqrt{{\frac{x^2}{x^2+a^2}}}\right)\mathrm dx = \frac14\left[x^2\ln\left(\frac{x^2}{x^2+a^2}\right) - a^2\ln\left(x^2+a^2\right)\right] + \frac12 a^2 \ln(a) + C' \\ = \frac14\left[x^2\ln\left(\frac{x^2}{x^2+a^2}\right) - a^2\ln\left(\frac{x^2+a^2}{a^2} \right)\right] + C', \end{multline} which takes logarithms only of unitless values.

An approach that might be a little more intuitively satisfying is to make all your constants and variables actually unitless within the integral. This can be done by the substitution $u = \frac xa$. We get $$ \int x\ln\left(\sqrt{{\frac{x^2}{x^2+a^2}}}\right)\mathrm dx = a^2 \int u\ln\left(\sqrt{{\frac{u^2}{u^2+1}}}\right)\mathrm du. $$ Solve the integral on the right-hand side via the usual methods of calculus and you will get the result $$ \int u\ln\left(\sqrt{{\frac{u^2}{u^2+1}}}\right)\mathrm du = \frac14\left[u^2\ln\left(\frac{u^2}{u^2+1}\right) - \ln(u^2+1)\right] + C. $$

Therefore \begin{align} \int x\ln\left(\sqrt{{\frac{x^2}{x^2+a^2}}}\right)\mathrm dx &= a^2 \left(\frac14\left[u^2\ln\left(\frac{u^2}{u^2+1}\right) - \ln(u^2+1)\right] + C\right) \\ &= \frac14\left[x^2\ln\left(\frac{x^2}{x^2+a^2}\right) - a^2\ln\left(\frac{x^2+a^2}{a^2}\right)\right] + C' \end{align} where $C' = Ca^2$ is just a constant of integration with the correct units.

David K
  • 108,155
2

Note that we can use the hyperbolic substitution $x=a\sinh t$ as it simplifies the argument of the logarithm:

$$\require{cancel}\begin{align}\int x\ln\left(\sqrt{\frac{x^2}{x^2+a^2}}\right)\mathrm dx&=\frac{a^2}2\int\sinh2t\ln|\tanh t|\mathrm dt\\&=\frac{a^2}4\int\ln|\tanh t|\mathrm d(\cosh2t)\\&=\frac{a^2}4\left(\cosh2t\ln|\tanh t|-2\int\text{csch2t}\cosh2t\mathrm dt\right)\\&=\frac{a^2}4\left((2\sinh^2t+1)\ln|\tanh t|-\ln|\sinh2t|\right)+C\\&=\frac{a^2}4\left(\frac{2x^2+a^2}{2a^2}\ln\left(\frac{x^2}{x^2+a^2}\right)-\ln\left|2\cdot\frac{x}{a}\cdot\frac{\sqrt{x^2+a^2}}{a}\right|\right)+C\\&=\frac{x^2}4\ln\left(\frac{x^2}{x^2+a^2}\right)+\frac{a^2}8\ln\left(\frac{x^2}{x^2+a^2}\right)-\frac{a^2}4\ln\left(\frac{2|x|\sqrt{x^2+a^2}}{a^2}\right)+C\\&=\frac{x^2}4\ln\left(\frac{x^2}{x^2+a^2}\right)+\frac{a^2}4\ln\left(\frac{\cancel{|x|}}{\sqrt{x^2+a^2}}\cdot\frac{a^2}{2\cancel{|x|}\sqrt{x^2+a^2}}\right)+C\\&= \frac{x^2}4\ln\left(\frac{x^2}{x^2+a^2}\right)+\frac{a^2}4\ln\left(\frac{a^2}{2(x^2+a^2)}\right)+C\end{align}$$

The term $\frac{a^2}4\ln\left(\frac{a^2}2\right)$ can be absorbed by the arbitrary constant of integration and hence, the anti-derivative can be simplified as

$$\frac{x^2}4\ln\left(\frac{x^2}{x^2+a^2}\right)-\frac{a^2}4\ln(x^2+a^2)+C$$

This explains the apparent dimensional inconsistency.

Integreek
  • 8,530
1

For an alternative way to evaluate the integral, we can make use of the standard integral

$$\int\ln|x|\mathrm dx=x\ln|x|-x+C$$

For this, rewrite your integral as $$\frac12\int x\ln(x^2)\mathrm dx-\frac12\int x\ln(x^2+a^2)\mathrm dx$$

Applying the aforementioned result, the integral evaluates to

$$\frac14(x^2\ln x^2-x^2)-\frac14\left((x^2+a^2)\ln(x^2+a^2)-x^2-a^2\right)+C$$ $$\require{cancel}=\frac{x^2\ln|x|}2\cancel{-\frac{x^2}4}-\frac{x^2+a^2}4\ln(x^2+a^2)+\frac{\cancel{x^2}+a^2}4+C$$ $$=\frac{x^2}4\ln\left(\frac{x^2}{x^2+a^2}\right)-\frac{a^2}4\ln(x^2+a^2)+C$$

Integreek
  • 8,530