Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: UnitStep Function in ODE

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47759] Re: UnitStep Function in ODE
  • From: ab_def at prontomail.com (Maxim)
  • Date: Sun, 25 Apr 2004 05:13:33 -0400 (EDT)
  • References: <c6d7q5$jdp$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Virgil Stokes <Virgil.Stokes at it.uu.se> wrote in message news:<c6d7q5$jdp$1 at smc.vnet.net>...
> 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:

In[1]:=
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]]&

Out[4]=
(-200. + 1.*y0 + 2.*((0. + 100.*E^(0.01*t))*UnitStep[20. - t] +
122.14027581601698*UnitStep[-20. + t]))/
  E^(0.01*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

In[1]:=
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]

Out[2]=
{UnitStep[1 - t]}

Out[3]=
{0}

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

http://library.wolfram.com/infocenter/MathSource/5117/

Example:

In[1]:=
USI[UnitStep[-x^2 + a*x + a], {x, -Infinity, Infinity}]

Out[1]=
Sqrt[a*(4 + a)]*UnitStep[-4 - a] + Sqrt[a*(4 + a)]*UnitStep[a]

Maxim Rytin
m.r at prontomail.com


  • 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