3
$\begingroup$

I've been baffled by a lot of the behaviours of Mathematica 9 — so much that I regret upgrading my copy of Mathematica 8 (I would downgrade but I'm currently on vacation). Here is an example:

DSolve[{x^2*y''[x] + x*y'[x] - y[x] == 0}, y[x], x]

should return the simple answer of C1*x + C2/x. In fact, this is what Wolfram Alpha returns and also Mupad (a Maple within Matlab). However, Mathematica returns

Mathematica picture

Yes, I know you can simplify this for real output, but it baffles me why it doesn't do it in the first place. Moreover, once your differential equations become messy, this can be hard to do. I have encountered other examples where the output from Mathematica's DSolve seems to very strange indeed. This isn't an isolated example, and I encounter examples of these very simple DEs that Mathematica fails to simplify in any sort of obvious way.

I don't remember these difficulties in Mathematica 8 or previous versions. Does anybody know what is an easy fix or what's going on? I have also documented similar bugs in the series expansions here and here.

$\endgroup$
1
  • $\begingroup$ These are not bugs. The output is correct. As Vitaliy points out, you simply need to constrain your problem appropriately. Early versions of Mathematica played fast and loose with real functions and real expressions -- leading to actual bugs/errors. Instead, this has been fixed by respecting the complex nature of many things (e.g. series/convergence). This makes certain tricks impossible if you fail to indicate to Mathematica that you are assuming all the variables in play are real. $\endgroup$ Aug 26, 2014 at 17:25

1 Answer 1

8
$\begingroup$

Constrain your assumptions:

Assuming[x \[Element] Reals, DSolve[{x^2*y''[x] + x*y'[x] - y[x] == 0}, y[x], x]]

{{y[x] -> 1/2 x C[1] + C[2]/x}}

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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