I have an equation $$\bigl(r''(\phi)r(\phi) - r'(\phi)^2\bigr)\bigl(b + r(\phi)\bigr) = r(\phi)\bigl(r'(\phi)^2 + r(\phi)^2\bigr)$$ Here $b$ and $r$ are lengths, and $\phi$ is an angle (in radians, so dimensionless). As recommended in another answer, I rewrite the equation in terms of the dimensionless variable $\tilde{r} = r/b$ by dividing both sides by $b^3$, obtaining $$\bigl(\tilde r''(\phi)\tilde r(\phi) - \tilde r'(\phi)^2\bigr)\bigl(1 + \tilde r(\phi)\bigr) = \tilde r(\phi)\bigl(\tilde r'(\phi)^2 + \tilde r(\phi)^2\bigr)$$ But putting this into Mathematica,
DSolve[(r''[ϕ] r[ϕ] - r'[ϕ]^2) (1 + r[ϕ]) ==
r[ϕ] (r'[ϕ]^2 + r[ϕ]^2), r, ϕ]
yields nothing - it works for a while and then returns the expression unevaluated.
On the other hand, if I put in the original equation, I get a solution reasonably quickly.
DSolve[(r''[ϕ] r[ϕ] - r'[ϕ]^2) (b + r[ϕ]) ==
r[ϕ] (r'[ϕ]^2 + r[ϕ]^2), r, ϕ]
Note that in Mathematica code, this is identical to the previous expression except that 1 has been replaced by b.
The solution (actually two solutions) can be represented as
$$r(\phi) = \frac{4 \left(b^2 c_1-1\right)^2}{i \left(1-b^2 c_1\right)^{3/2} e^{\pm i \sqrt{1-b^2 c_1} \left(c_2+\phi \right)}-4 i c_1 \sqrt{1-b^2 c_1} e^{\mp i \sqrt{1-b^2 c_1} \left(c_2+\phi \right)}-4 b c_1 \left(b^2 c_1-1\right)}$$
I find it strange that Mathematica is able to solve the equation with a named constant (b) but not with a number in its place, considering that the switch is unrelated to the dependent and independent variables in the problem, and I see no reason that $b = 1$ prevents the solution from being valid. Am I missing some problem that arises with the solution when $b = 1$?
More importantly, is there a general lesson I can take from this about how to enter equations into Mathematica to give it the best chance of finding a solution?
I'm using version 10.3.0 on Mac OS X El Capitan.
I do note that the solution Mathematica produces is not dimensionally consistent, if one takes $b$ to have dimensions of length, but that's a separate issue.
Sometimes the generalization works because, as you mentioned, the solution wouldn't be valid at b=1. Substituting the solutions back, it seems to be find though.
The lesson I'd learn is that the pattern matcher can only try so many things and sometimes strange things like making the problem harder help it to find a solution.
– Searke Jan 04 '16 at 15:49NDSolvereadily solves some initial value problems forb=1. Attempts to find correspondingC[1],C[2]for the generic solution did not prove fruitful, but I didn't work at it too hard. – george2079 Jan 04 '16 at 15:59True, which I think should be fairly reliable. – David Z Jan 04 '16 at 16:07NDSolvereturns a useful result for a general case and a less useful result for a specific case: About a simple differential equation. Note, though, that this one had to do with boundary conditions rather than parameters in the ODE itself. – Michael Seifert Jan 05 '16 at 17:01