7
$\begingroup$

Bug introduced in 8.0.4 or earlier, persisting in part through 11.3.


I was willing to solve this nonlinear PDE:

DSolve[D[l[w1, w2], w1] 0.5 w2 - D[l[w1, w2], w2] 0.5 w1 - w1 == 0, 
 l[w1, w2], {w1, w2}]

Any general solution is ok, so I didn't include boundary conditions. My goal is only to find out if there is a l[w1,w2] that solves the equation. Mathematica isn't outputting anything. What is it I'm getting wrong?

EDIT

I would like to point out that such a solution may easily be found by hand. For instance this already is a possible solution:

$l=-2*w2+A(w1^2 + w2^2)$

with A being any constant.

$\endgroup$
  • $\begingroup$ When plotting numerically I get the warning: "No DirichletCondition or Robin-type NeumannValue was specified for \ {l}; the result is not unique up to a constant" $\endgroup$ – Feyre Nov 7 '16 at 12:57
  • $\begingroup$ Sorry, would you paste your bits of code. I don't receive any result at all. I don't expect the result to be unique as I have not specified any sort of boundary condition. I'm just interested in verifying that \{l} exists. @Feyre $\endgroup$ – Mirko Aveta Nov 7 '16 at 13:30
  • $\begingroup$ Like I said, I could only solve it numerically: s=NDSolve[D[l[w1, w2], w1] 0.5 w2 - D[l[w1, w2], w2] 0.5 w1 - w1 == 0, l[w1, w2], {w1, 0, 3}, {w2, 0, 3}][[1,1,2]]. Plot with: Plot3D[s, {w1, 0., 3.}, {w2, 0., 3.}] $\endgroup$ – Feyre Nov 7 '16 at 13:44
6
$\begingroup$

A solution can be obtained easily using DSolve, if 0.5 is replaced by 1/2.

Flatten@DSolve[D[l[w1, w2], w1]  w2/2 - D[l[w1, w2], w2] w1/2 - w1 == 0, 
    l[w1, w2], {w1, w2}]
(* {l[w1, w2] -> -2 Sqrt[w2^2] + C[1][1/2 (w1^2 + w2^2)], 
    l[w1, w2] -> 2 Sqrt[w2^2] + C[1][1/2 (w1^2 + w2^2)]} *)

It is not obvious (to me) why this change matters, because

0.5 == 1/2
(* True *)

Addendum

As noted below by xzczd, one of the two solutions derived here is spurious due to a bug in DSolve. To show this, plug the two solutions in turn into the original PDE:

FullSimplify[Unevaluated[D[l[w1, w2], w1]  w2/2 - D[l[w1, w2], w2] w1/2 - w1] /. #] & /@ %%
(* {w1 (-1 + w2/Sqrt[w2^2]), -((w1 (w2 + Sqrt[w2^2]))/w2)} *)

Thus, only the first solution is valid for w2 > 0, and only the second for w2 < 0. This error is related to the one discussed in more detail in 130857.

Update for Version 11.1.0

With version 11.1,

Flatten@DSolve[D[l[w1, w2], w1] 0.5 w2 - D[l[w1, w2], w2] w1/2 - w1 == 0, 
    l[w1, w2], {w1, w2}] // Simplify
(* {l[w1, w2] -> -2 Sqrt[w2^2] + C[1][1/2 (w1^2 + w2^2)], 
    l[w1, w2] -> 2 Sqrt[w2^2] + C[1][1/2 (w1^2 + w2^2)]} *)

which is the machine-precision equivalent of the first result in this answer. This certainly is a step in the right direction. However, the problem remains only one of the two solutions is correct.

$\endgroup$
  • 1
    $\begingroup$ It might be the old "Rationalize" thing. I often bump into this sort of problem. I never get why some times it works and othertimes it doesn't. $\endgroup$ – Mirko Aveta Nov 7 '16 at 20:41
  • 1
    $\begingroup$ @MirkoAveta Your suggestion seems reasonable and was, in fact, my first thought. However, the fact that 0.5 == 1/2 is True causes me to wonder. I ran Trace[] on both versions but obtained no useful insight. Trace[] with TraceInternal->True might be more informative, but would take a while to assess, because the output probably would be huge. $\endgroup$ – bbgodfrey Nov 7 '16 at 20:49
  • 1
    $\begingroup$ I just want to point out this solution has the same issue as the one you mentioned in this post, the correct solution is actually l -> Function[{w1, w2}, -2 w2 + C[1][1/2 (w1^2 + w2^2)]] $\endgroup$ – xzczd Nov 12 '16 at 3:48
  • $\begingroup$ @xzczd Yes, I somehow overlooked this connection. Thanks. $\endgroup$ – bbgodfrey Nov 12 '16 at 3:53

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.