I think you are trying to do the following:
Clear[h];
h[n_] /; n >= 1 := -((I^-n (-1 + I^n)^2)/(n^2 Pi^2))
h[0] = 1/4;
Clear[y];
y[m_] := DiscreteConvolve[h[n], DiscreteDelta[n], n, m]
y[0]
(* ==> 1/4 *)
Here corrected your definition of y
so it uses m
as the function argument, but the important part is to understand why even with this correction your code didn't work:
The definition of h[n_]
would be superseded by the specific definition h[0]
if you directly asked for h[0]
. However, when passed to DiscreteConvolve
as an argument in the form h[n]
, this specific case is not used and instead h[n]
is expanded to the generic expression (which is indeterminate at n=0
). The remaining calculation then never knows that the expression came from h
in the first place. This happens because DiscreteConvolve
doesn't hold its arguments unevaluated by default.
So you have to make sure this initial expansion of h[n]
doesn't occur. I do this above by adding a condition ;n>=1
to the left-hand side of the line defining h[n_]
. This makes it clear that this definition is not to be used for all n
. Then the generic term h[n]
remains un-expanded when it is passed to DiscreteConvolve
, giving it a chance to see that there is a different definition for h[0]
.
h[n_]
then use it as justh
with no arguments. ?DiscreteConvolve[h,DiscreteDelta[n],n,m]
try it withh[n]
, also do not understand why you use=
and not:=
in the definition. $\endgroup$ – Nasser May 31 '14 at 17:15