MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: UnitStep Function in ODE

Virgil Stokes <Virgil.Stokes at> wrote in message news:<c6d7q5$jdp$1 at>...
> Why it this the following so hard for Mathematica 5.0.0
>    c[t] = 0.2*UnitStep[20 - t];
>    eqn = y'[t] == 10.0*c[t] - 0.01*y[t]
>    DSolve[{eqn, y[0] == y0}, y[t], t] // FullSimplify
> --V. Stokes

Since the solution returned by DSolve should not depend on the K$95
parameter (the number after $ will vary), we can just try to
substitute some specific value for K$95. In this case, for any value
of K$95 we'll get the same function:

c[t] = 0.2*UnitStep[20 - t];
eqn = y'[t] == 10.0*c[t] - 0.01*y[t];
sol = DSolve[{eqn, y[0] == y0}, y[t], t];

y[t] /. First[sol] /. K$95 -> -Infinity //
  Refine[#, Element[t, Reals]]&

(-200. + 1.*y0 + 2.*((0. + 100.*E^(0.01*t))*UnitStep[20. - t] +
122.14027581601698*UnitStep[-20. + t]))/

Now we have an expression which we can evaluate numerically for any
values of y0 and t. It agrees with the numerical solution obtained
with NDSolve.

Unfortunately, Mathematica often fails on such examples; consider

sol = DSolve[{y'[t] == y[t] + UnitStep[1 - t], y[0] == 0}, y, t];
Simplify[y'[t] - y[t] /. sol, K$94 < 1]
Simplify[y'[t] - y[t] /. sol, K$94 > 1]

{UnitStep[1 - t]}


So, strictly speaking, DSolve doesn't return a correct solution here
-- it is only valid if we choose K$94<1.

As a side note, if you need to symbolically evaluate integrals of
UnitStep which come up in the first DSolve example, try


USI[UnitStep[-x^2 + a*x + a], {x, -Infinity, Infinity}]

Sqrt[a*(4 + a)]*UnitStep[-4 - a] + Sqrt[a*(4 + a)]*UnitStep[a]

Maxim Rytin
m.r at

  • Prev by Date: Re: undocumented function StringQ
  • Next by Date: Re: addition of three angular momenta
  • Previous by thread: UnitStep Function in ODE
  • Next by thread: Re: UnitStep Function in ODE