Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When DSolve tries to solve differential equations, it is sometimes not smart enough to generate conditions according to different possible value of parameters. Consider the following minimal example, $x'=x^2-a$:

DSolve[x'[t] == x[t]^2 - a, x[t], t]

The result is

{{x[t] -> -Sqrt[a] Tanh[Sqrt[a] t - Sqrt[a] C[1]]}}

This would be wrong if $a \leq 0$. (When $a<0$ one may argue that the above result is correct in the sense of complex $\tanh$ function; I did not bother to think about this, but this is definitely not we normally want.)

If the problem at hand is Integrate, we can use Assumptions to explicitly state the range of parameter; but DSolve does not provide such an option. So, is there any way to achieve a similar effect? I tried to use Boole etc. but failed.

share|improve this question
    
Can you use the equivalent of DSolve[x'[t] == x[t]^2 - b^2, x[t], t] or DSolve[x'[t] == x[t]^2 + b^2, x[t], t] ? –  b.gatessucks Apr 4 '13 at 7:59
    
@b.gatessucks Yeah, I use that kind of workaround since I've no choice. But not every constraint can be avoided this easily. –  KevinSayHi Apr 4 '13 at 15:19
    
Try FullSimplify your resulting solution, you can put in Assumptions there. –  user7705 May 30 '13 at 9:53

1 Answer 1

Actually the only offending value here is $a=0$

(this can be seen easily if you calculate the integral

 Integrate[1/(x^2 - a), x]

).

For all the other values of $a$ the solution given is valid. The problem is that for $a=0$ we have what is called a singular solution for the ODE. This is something difficult to cope with in general and assuming won't help you with. I am still actively looking at this issue, in sometimes i was successful to implement a "patch" to DSolve to overcome this but not always, like this situation.

If your DE includes many parameters and/or arbitrary functions it might be useful to find the equivalence transformations for this class of DE and through them to study instead the better representative of this class including the least number of parameters.

share|improve this answer
    
Thanks for answering, but "assuming" will obviously help us since we can Assumptions -> a>0,Assumptions -> a<0, or Assumptions -> a==0 (Yeah I mentioned that for a<0 the solution is correct in the complex sense but we seldom want a complex solution for a real ODE). The underlying problem is integration in this simple example, but the distinction is Integrate allows Assumptions while DSolve does not. I don't need Mathematica to be smart enough to recognize the singular solution; I just want it to be flexible enough so that human can intervene. That's exactly the problem. –  KevinSayHi Apr 4 '13 at 19:29
    
I mentioned Integrate for a reason, if you include the option Assumptions you will see that for the two cases $a<0,\ a>0$ it gives the same answer. When the problem is more complex you cant see from the beginning the domain of the parametric space that will give you real solutions. So making an assumption a priori might not be the correct way to handle the problem in general. –  Spawn1701D Apr 4 '13 at 19:36
    
Oh sorry, you are right. I had some wrong memories in my mind when I wrote the previous lines. –  KevinSayHi Apr 5 '13 at 3:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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