# DSolve returns a “wrong” solution

This wrong solution exists from mma9 to mma10.1:

DSolve[{r''[t] == k/r[t]^2}, r[t], t]
(*Solve[((k Log[-k + C[1] r[t] +
Sqrt[C[1]] Sqrt[C[1] - (2 k)/r[t]] r[t]])/C[1]^(3/2) + (
Sqrt[C[1] - (2 k)/r[t]] r[t])/C[1])^2 == (t + C[2])^2, r[t]]*)


Though it is hard to verify whether it's true or false, you may find this solution strange through dimensional analysis, provided that you are physicists or students major in physics.

• @Dr. Wolfgang Hintze – WateSoyan Jun 6 '15 at 11:17
• This means DSolve[] was at least able to derive an implicit definition of the function that solves your differential equation. – J. M.'s technical difficulties Jun 6 '15 at 11:49
• What is the other solution, eg. the one previously obtained with Mathematica 9? – gwr Jun 6 '15 at 12:12
• What does this equation represent? – Gregory Rut Jun 6 '15 at 12:19
• What about converting the problem into a system of ODE, e.g. there is a (somehwat complicated) solution to DSolve[{ r1'[t] == r2[t], r2'[t] == k/(r1[t]*r1[t])}, { r1[t], r2[t] }, t] ? – gwr Jun 6 '15 at 12:24

The answer isn't "wrong", per se, it's just incomplete. The differential equation $\ddot{r} = k/r^2$ should yield the motion of a particle falling in radially in a Newtonian potential, and $k$ should have dimensions of [distance]3/[time]2. However, the Mathematica solution appears to require you to take the logarithm of a dimensional variable, which shouldn't be possible.

The answer is that solutions to differential equations are definite integrals, not indefinite. The full solution should be (LHS at time $t$) - (LHS at time $t_0$) = (RHS at time $t$) - (RHS at time $t_0$). When you take the difference of the two logarithms on the LHS, you can just rewrite it as the ratio of their arguments; and so you end up taking the logarithm of a nice dimensionless variable.

As another example, consider the integral $$\int \frac{dx}{\sqrt{a^2 + x^2}}.$$ This integral would arise when finding the electric potential a distance $a$ away from a charged rod. $x$ has the dimensions of length, and so the indefinite integral isn't dimensionally consistent:

Integrate[(a^2 + x^2)^(-1/2), x]
(* Log[x + Sqrt[a^2 + x^2]] *)


But the definite integral is:

Integrate[1/Sqrt[a^2 + x^2], {x, x1, x2}, Assumptions -> {a > 0, x2 > x1 > 0}]
(* Log[(x2 + Sqrt[a^2 + x2^2])/(x1 + Sqrt[a^2 + x1^2])] *)


EDIT:

If you use Mathematica's built-in support for units, Mathematica appears to be smart enough to know to put the integral in an explicitly dimensionless form:

integrand = 1/Sqrt[Quantity[1, "Meters"]^2 + x^2]
Integrate[integrand, x]
(* ArcSinh[x (Quantity[1, 1/("Meters")])] *)


If $x$ is entered into the above equation in meters, we get something appropriately dimensionless.

I have so far been unable to persuade Mathematica to do the same thing for DSolve; in the documentation, symbolic units support seems to be confined to Solve, Integrate, and D. If I make any further progress on this front, I'll be sure to update this answer.

• The dimension of k is not velocity^2 but L^3/T^2. – luyuwuli Jul 3 '15 at 12:37
• @luyuwuli: Thanks for the correction! – Michael Seifert Jul 3 '15 at 16:13

This problem is more related to physics other than Mathemaitca. The solution isn't wrong and special care should be paid when analysing dimensions in logarithm.

"Inconsistancy" of the dimensions in logarithm is quite common and necessary in physics. Let's take a naive example to illustate the "inconsistancy":

$$\int \frac{1}{x} dx$$

Everyone knows that the solution is $\log(x)$, but if you think a step further and start checking it's dimension, you may probably be stuck: The dimension in log function isn't 0 in any sense.

From math we know the trivial fact: $\log(x_1)-\log(x_0)=\log(x_1/x_0)$, from the physics point of view, however, this means the dimension cancellation. This is more like a prediction procedure: measuring/define something at one point ($x_0$), making predictions at another point($x_1$).

If you see a lonely logarithm function with weird dimension, what you should keep in mind is this term can't be the final prediction expression; he is always waiting for some other logarithms to combine into a dimensionless one.

Another example is dimensional regularization in quantum field theory, what shows up frequently is

$$-\gamma_E+\ln 4\pi +\ln \mu^2 -\ln\Delta ,$$

where $\Delta$ has dimension [mass]^2, $\mu$ has dimension [mass]. The two terms always show up at the same time.

So how to understand this? Honestly, nothing special happens here, what we'll do is to change the understanding about dimensional analysis. If you actually want to do some real physics,(making predictions etc. ) you have to deal with definite integral (never indefinite integral). The solution above in some kind of sense is just a intermediate result.

Amazingly, this "inconsistancy" only happens to logarithms. You'll never encounter terms like $\sin(L)$ or $e^L$ even in the intermediate steps, because we don't have an operation to cancel the dimension.

I can't offer you a strict proof, but I can give you a feel by using Taylor expansion.

For simplicity, let's assume $x$ and $a$ have dimension [Length]. Let's check on three functions: logarithm, tangent and exponential.

$\log(x)=\log (a)+\frac{x-a}{a}-\frac{(x-a)^2}{2 a^2}+O\left((x-a)^3\right)$

$\tan(x)=\tan (a)+(x-a) \left(\tan ^2(a)+1\right)+(x-a)^2 \left(\tan ^3(a)+\tan (a)\right)+O\left((x-a)^3\right)$

$e^x=e^a+e^a (x-a)+\frac{1}{2} e^a (x-a)^2+O\left((x-a)^3\right)$

For exponential case, by dimensional analysis: $$[e^x]= [e^L]*(L^0+L+L^2+...),$$

Even if we can factor out the weird dimension[e^L], there are inconsistancy in the sum. This happens to the tangent function as well. As you can see, in the tangent or exponential function, the inconsistancy lies in the vein of them; the pathological behavior is incurable.

However, let's check the logarithm function: $$[\log(x)]=[\log (a)]+(L^0+L^0+...),$$

the ill-defined dimension can all blame on $log(a)$, the inconsistancy doesn't show up in the sum. That's why we need another logarithm to cancel the $log(a)$ term, becoming dimensionless (by substraction).