Re: DiscreteDelta and RSolve Bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg68071] Re: [mg67981] DiscreteDelta and RSolve Bug?
- From: Devendra Kapadia <dkapadia at wolfram.com>
- Date: Fri, 21 Jul 2006 17:36:13 -0400 (EDT)
- References: <200607201004.GAA09700@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Thu, 20 Jul 2006, Mariusz Jankowski wrote:
> Hello, I recently came across the following situation while solving a
> difference equation, specifically the unit impulse response of a simple
> system. For this example I have reduced the system to a first-order as it
> illustrates the main problem.
>
> The following evaluation seems to hang
>
> RSolve[{y[n] - 1/2 y[n - 1] == DiscreteDelta[n], y[-1] == 0}, y[n], n]
>
>
>
> Is there an explanation? Note that the following alternatives work as
> expected:
>
> RSolve[{y[n] - 1/2 y[n - 1] == 0, y[0] == 1}, y[n], n]
>
> RSolve[{y[n] - 1/2 y[n - 1] == KroneckerDelta[n], y[-1] == 0}, y[n], n]
>
>
>
>
>
> Thanks, Mariusz
Hello Mariusz,
Thank you for reporting this problem with RSolve and DiscreteDelta.
Since the difference equation considered by you is inhomogeneous, we
perform a symbolic summation to find the general solution. The lower
limit of this symbolic sum needs to be chosen carefully in order to
avoid a trivial solution. RSolve hangs while trying to find this lower
limit when the right hand side has DiscreteDelta in it.
As noted by you, the equivalent formulation with KroneckerDelta works
fine, so this provides a partial workaround for the problem:
=======================
In[1]:= $Version
Out[1]= 5.2 for Linux (June 27, 2005)
In[2]:= InputForm[Timing[RSolve[{y[n] - 1/2 y[n - 1] == KroneckerDelta[n],
y[-1] == 0}, y[n], n]]]
Out[2]//InputForm= {0.18*Second, {{y[n] -> UnitStep[n]/2^n}}}
In[3]:= InputForm[Table[y[n]/.%[[2,1]], {n, -1, 6}]]
Out[3]//InputForm= {0, 1, 1/2, 1/4, 1/8, 1/16, 1/32, 1/64}
In[4]:= y1[-1] = 0;
In[5]:= y1[n_] := 1/2 y1[n - 1] + DiscreteDelta[n]
In[6]:= InputForm[Table[y1[n], {n, -1, 6}]]
Out[6]//InputForm= {0, 1, 1/2, 1/4, 1/8, 1/16, 1/32, 1/64}
====================================
I apologize for the inconvenience caused by this problem.
Sincerely,
Devendra Kapadia.
Wolfram Research, Inc.
- References:
- DiscreteDelta and RSolve Bug?
- From: "Mariusz Jankowski" <mjankowski@usm.maine.edu>
- DiscreteDelta and RSolve Bug?