8
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I like the way you phrased this question. I remember seeing an instance of this before (where generalizing a diffeq by replacing a number with a symbol worked), but I couldn't find it. 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. $\endgroup$ – Searke Jan 4 '16 at 15:49
  • 1
    $\begingroup$ If you look at the solution, the case where b=1 looks very special and this probably has a lot to do with the behavior. $\endgroup$ – Searke Jan 4 '16 at 15:49
  • $\begingroup$ I would try to investigate the correctness of the generic solution by considering a numerical example. NDSolve readily solves some initial value problems for b=1. Attempts to find corresponding C[1],C[2] for the generic solution did not prove fruitful, but I didn't work at it too hard. $\endgroup$ – george2079 Jan 4 '16 at 15:59
  • 1
    $\begingroup$ @Searke well, $b$ always occurs in combination with the arbitrary constant $c_1$. Certainly the case where $b^2 c_1 = 1$ is special, but I don't think that implies anything about merely having $b = 1$. $\endgroup$ – David Z Jan 4 '16 at 16:00
  • 1
    $\begingroup$ Here's another example (perhaps the one @Searke was thinking of) where NDSolve returns 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. $\endgroup$ – Michael Seifert Jan 5 '16 at 17:01
3
$\begingroup$

In fact, b = 1 is special, at least to DSolve. DSolve returns an answer for any other value of b that I have tried. Further, replacing b by a numerical value very close to 1 yields a surprising (to me) result.

DSolve[{(r''[ϕ] r[ϕ] - r'[ϕ]^2) (1 + 10^-10 + r[ϕ]) == r[ϕ] (r'[ϕ]^2 + r[ϕ]^2)}, 
    r[ϕ], ϕ] // FullSimplify
(* {{r[ϕ] -> (4 E^(I Sqrt[1 - 100000000020000000001 C[1]] (ϕ + C[2])) 
     (1 - 100000000020000000001 C[1])^(3/2))/
     (I + (-100000000020000000001 I + 40000000000 
     E^(I Sqrt[1 - 100000000020000000001 C[1]] (ϕ + C[2])) 
     (-10000000000 I E^(I Sqrt[1 - 100000000020000000001 C[1]] (ϕ + C[2])) +
     10000000001 Sqrt[1 - 100000000020000000001 C[1]])) C[1])}, 
    {r[ϕ] -> (4 (1 - 100000000020000000001 C[1])^2)/
     (I E^(I Sqrt[1 - 100000000020000000001 C[1]] (ϕ + C[2])) 
     (1 - 100000000020000000001 C[1])^(3/2) - 
     400000000000000000000 I E^(-I Sqrt[1 - 100000000020000000001 C[1]] (ϕ + C[2])) 
     Sqrt[1 - 100000000020000000001 C[1]] C[1] - 
     400000000040000000000 C[1] (-1 + 100000000020000000001 C[1]))}} *)

The correspnding answer for 1 + 10^-100 is far longer still, as is the answer for 1 - 10^-100. Whatever DSolve is doing internally, it certainly has singled out b = 1 as something special.

Incidentally,

SetOptions[Solve, Method -> Reduce]

causes DSolve to return unevaluated in the few instances I have tried.

$\endgroup$
  • 1
    $\begingroup$ Weird, but interesting. It kind of looks like the symbolic solution I included in the post, but with $b^2$ replaced by $\frac{1}{(b - 1)^2}$. I guess in that case $b = 1$ clearly would be special. Perhaps this is a separate solution? $\endgroup$ – David Z Jan 5 '16 at 9:50
  • 1
    $\begingroup$ Actually, I figured it out: this is the same solution identified in my question, just with a different definition of $c_1$. It differs by a factor of $10^{20}$, as you can show with something like FullSimplify[r[phi]/.mysoln/.b->1+10^-10/.C[1]->10^20C[1] == r[phi]/.yoursoln]. Apparently, when we give b a symbolic value of a certain form, Mathematica absorbs a constant factor into $c_1$ to simplify the result a bit. This particular simplification procedure fails at $b=1$, but the solution itself should be fine. $\endgroup$ – David Z Jan 7 '16 at 15:33
  • $\begingroup$ Interesting. Add it as an answer. Well done. $\endgroup$ – bbgodfrey Jan 7 '16 at 17:19
  • $\begingroup$ Oh, sorry if I was misleading: what I figured out is the apparent discrepancy between the partially-numeric solution you put in your answer and the symbolic one in my question. But that leaves me no closer to finding an answer to the original posted question. $\endgroup$ – David Z Jan 7 '16 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.