Message Boards Message Boards

DSolve gives result Complex infinity, but gives different result with simplified input

Posted 6 months ago

Hello, Can anybody explain to me which of these results returned by DSolve is correct and why? If I try

resA=DSolve[u''[x]-(s/D)*u[x]==-(k/D)*(u0/s)*(1-Exp[-Sqrt[s/D]*x]),u[x],x];
resB=FullSimplify[resA];
Export["res.txt",resB];

I get "Complex infinity" as a result. But if I simplify the above, by setting a=s/D and b=(k/D)*(u0/s), and try

resA=DSolve[u''[x]-a*u[x]==-b*(1-Exp[-Sqrt[a]*x]),u[x],x];
resB=FullSimplify[resA];
Export["res.txt",resB];

I get

{u[x] -> b/a + E^(Sqrt[a]*x)*C[1] - (b + 2*Sqrt[a]*b*x - 4*a*C[2])/(4*a*E^(Sqrt[a]*x))}

which is clearly a different result.
Leslaw

POSTED BY: Leslaw Bieniasz
2 Replies

Hi Leslaw,

Beware: D is the partial derivative function, and should not be used as a variable/parameter/user-function name. (Best to avoid single capitals and starting user-symbol names with capitals, when possible.)

That said, I do not get ComplexInfinity for either code in your post (neither on V13.3.1, MacOS nor on wolframcloud.com).

I get a simpler result for the first one, using Gianluca's assumption, from

resA = DSolve[
  u''[x] - (s/D)*u[x] == -(k/D)*(u0/s)*(1 - Exp[-Sqrt[s/D]*x]) /. 
   D -> B, (* changed D to B *)
 u[x], x, Assumptions -> B > 0]

It might not be any help. If you're using an older version, prehaps try upgrading or wolframcloud.com.

POSTED BY: Michael Rogers

In version 13.3 I get the error with

resA = DSolve[
  u''[x] - (s/D)*u[x] == -(k/D)*(u0/s)*(1 - Exp[-Sqrt[s/D]*x]), u[x], 
  x]
resB = FullSimplify[resA, D > 0]

I suppose it has something to do with a wrong choice of sign for Sqrt during the calculation,

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract