       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
• 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[f][t] + (2*l + m)*Derivative[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, Derivative[f] == 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, f' == 0},
>     f, {t, 0, 10}][]
>
> 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?
>
>
> 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
below).

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

In:=  \$Version

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

In:=  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:=  ilt = InverseLaplaceTransform[(LaplaceTransform[f[t], t, s] /.
Solve[LaplaceTransform[eq, t, s],
LaplaceTransform[f[t], t, s]][]) /. {f :> 0,
f' :> 0}, s, t];

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

Out//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:= FullSimplify[{eq, f, f'}]

Out= {True, 0, 0}

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

Out= {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:= Clear[f]

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

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

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

Out= {0, 0.376615, 0.411939, 0.306131, 0.198231, 0.119471}

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

I apologize for the inconvenience caused by this problem.

Sincerely,