DSolve sometimes returns solutions containing explicit complex numbers, even though the ODE does not. For instance (drawn from question 126072),

DSolve[a w''''[x] == -b + c (d - w[x] + e x), w[x], x, Assumptions -> a > 0 && c > 0]
    // Flatten
(* {w[x] -> (-b + c d + c e x)/c + E^((-1)^(3/4) (c/a)^(1/4) x) C[1] + 
    E^(-(-1)^(1/4) (c/a)^(1/4) x) C[2] + E^(-(-1)^(3/4) (c/a)^(1/4) x) C[3] + 
    E^((-1)^(1/4) (c/a)^(1/4) x) C[4]} *)

I would prefer instead that the answer returned be the equivalent

(* {w[x] -> -(b/c) + d + e x + E^(-(((c/a)^(1/4) x)/Sqrt[2])) (C[1] + C[3] 
    E^(Sqrt[2] (c/a)^(1/4) x)) Cos[((c/a)^(1/4) x)/Sqrt[2]] + 
    E^(-(((c/a)^(1/4) x)/Sqrt[2])) (C[2] - C[4] E^(Sqrt[2] (c/a)^(1/4) x)) 
    Sin[((c/a)^(1/4) x)/Sqrt[2]]} *)

which is free of explicit complex numbers. (Note that the C[_] in the two expressions are not the same.)

My question is, how can DSolve be caused to return expressions free of explicit complex numbers when the original ODE is free of complex numbers? To be sure, such solutions can be transformed to eliminate complex numbers after being returned by DSolve, but that is not what I am asking.

  • $\begingroup$ Very hard question. Actually there're many similar questions in this site (mostly about Integrate though), for example mathematica.stackexchange.com/q/10253/1871 mathematica.stackexchange.com/q/25117/1871 mathematica.stackexchange.com/q/72651/1871 . As one can see, none of the questions above is really solved, transforming the result is already challenging. $\endgroup$
    – xzczd
    Commented Sep 15, 2016 at 7:07
  • $\begingroup$ @xzczd Thanks especially for the first link, which I had missed in my search. I know how to transform from the first to the second form of the answer in my question, but doing so is not general but instead takes advantage of the details of the first answer. I had hoped that someone had found a way to redefine one of the many functions called by DSolve internally to give real answers. I plan to give this more thought when I have the time. (A solution internal to DSolve would be best, because boundary conditions could be applied at the same time.) $\endgroup$
    – bbgodfrey
    Commented Sep 15, 2016 at 13:21


Your Answer

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

Browse other questions tagged or ask your own question.