Re: Problem with symbolic solution of a differential

• To: mathgroup at smc.vnet.net
• Subject: [mg81609] Re: [mg81574] Problem with symbolic solution of a differential
• From: Devendra Kapadia <dkapadia at wolfram.com>
• Date: Sat, 29 Sep 2007 02:28:05 -0400 (EDT)
• References: <200709280609.CAA27001@smc.vnet.net>

```On Fri, 28 Sep 2007, Jepessen wrote:

> Hi to all.
>
> I've a problem with a differential equation, with Mathematica 6.0.1
> (Linux 32 bit)
>
> When I try to solve it simbolically, it returns me an error of
> indetermination.
>
> This is the equation
>
> eq = Derivative[2][f][t] + (2*l + m)*Derivative[1][f][t] +
>       l^2*f[t] == ((m + Sqrt[m*(4*l + m)])/(2*Sqrt[m*(4*l + m)]))*
>         Exp[(-(t/2))*((2*l + m) - Sqrt[m*(4*l + m)])] +
>       ((-m + Sqrt[m*(4*l + m)])/(2*Sqrt[m*(4*l + m)]))*
>         Exp[(-(t/2))*((2*l + m) + Sqrt[m*(4*l + m)])]
>
> This is the command that I use
>
> DSolve[{eq, f[0] == 0, Derivative[1][f][0] == 0}, f, t]
>
> and it returns me this error
>
> \[Infinity]::indet: "Indeterminate expression \
> ComplexInfinity+ComplexInfinity encountered. "
>
>
> So, I've tried to solve it numerically, and it works fine.
>
> fun = f /.
>  NDSolve[{Evaluate[eq /. {m -> .5, l -> .8}], f[0] == 0, f'[0] == 0},
>     f, {t, 0, 10}][[1]]
>
> Plot[fun[x], {x, 0, 10}]
>
> I obtain the right graph.
>
> I obviously know that there are equation that mathematica can't solve
> simbolically but, in these cases, it should return the unevaluated
> expression, instead of an error, especially considering that numerical
> method is fine.
>
> There's something that I can do to obtain a symbolic solution?
>
> Thanks for answers
>
> Daniele Lupo
>
>
Hello Daniele,

Thank you for reporting the incorrect behavior of DSolve for the
second-order differential equation considered by you.

The problem appears to be caused by an incorrect result from
symbolic integration while trying to compute a particular
solution for the inhomogeneous equation.

A partial workaround for the problem is to apply the Laplace
transform to obtain a symbolic solution for f[t] (see Out[4]
below).

===========================

In[1]:=  \$Version

Out[1]= 6.0 for Linux x86 (32-bit) (June 28, 2007)

In[2]:=  eq = f''[t] + (2*l + m)*f'[t] + l^2*f[t] == ((m +
Sqrt[m*(4*l + m)])/(2*Sqrt[m*(4*l + m)]))*
Exp[(-(t/2))*((2*l + m) - Sqrt[m*(4*l + m)])] + ((-m +
Sqrt[m*(4*l + m)])/(2*Sqrt[m*(4*l + m)]))*
Exp[(-(t/2))*((2*l + m) + Sqrt[m*(4*l + m)])];

In[3]:=  ilt = InverseLaplaceTransform[(LaplaceTransform[f[t], t, s] /.
Solve[LaplaceTransform[eq, t, s],
LaplaceTransform[f[t], t, s]][[1]]) /. {f[0] :> 0,
f'[0] :> 0}, s, t];

In[4]:= (f[t_] = Simplify[ilt])//InputForm

Out[4]//InputForm=
(2 - 4*l*t - m*t + Sqrt[m]*Sqrt[4*l + m]*t + E^(Sqrt[m]*Sqrt[4*l + m]*t)*
(-2 + 4*l*t + m*t + Sqrt[m]*Sqrt[4*l + m]*t))/
(2*E^(((2*l + m + Sqrt[m]*Sqrt[4*l + m])*t)/2)*Sqrt[m]*(4*l + m)^(3/2))

============================

In the following, we verify the solution and calculate a few values
for it:

==========================

In[5]:= FullSimplify[{eq, f[0], f'[0]}]

Out[5]= {True, 0, 0}

In[6]:= Table[f[t] /. {m -> .5, l -> .8}, {t, 0, 10, 2}]

Out[6]= {0, 0.376615, 0.411939, 0.306131, 0.198231, 0.119471}

===========================

After clearing the expression for 'f[t]', we see that the values
agree quite well with those given by NDSolve.

==========================

In[7]:= Clear[f]

In[8]:= sol = NDSolve[{Evaluate[eq /. {m -> .5, l -> .8}], f[0] == 0,
f'[0] == 0}, f, {t, 0, 10}]

Out[8]= {{f -> InterpolatingFunction[{{0., 10.}}, <>]}}

In[9]:= Table[f[t] /. %[[1]],  {t, 0, 10, 2}] // Chop

Out[9]= {0, 0.376615, 0.411939, 0.306131, 0.198231, 0.119471}

==========================

I apologize for the inconvenience caused by this problem.

Sincerely,