Bug in z_transform.mac?



"Pouya D. Tafti" <pouya.tafti at a3.epfl.ch> writes:
> On 6 January 2011 20:31, Mark H Weaver <mhw at netris.org> wrote:
>> z_transform.mac includes the following rule:
>>
>> ?defrule (r913_2b,
>> ? ? ?z_transform (unit_step (nn%), nn%, zz%),
>> ? ? ?zz/(zz - 1));
>>
>> Presumably this package is meant to compute the unilateral
>> Z-transform, which is defined as follows: (according to
>> http://en.wikipedia.org/wiki/Z-transform )
>>
>> ?z_transform(f(n),n,z) = sum(f(n)*z^(-n), n,0,inf)
>>
>> By this definition, the rule above is incorrect. ?The rule would be
>> correct for a right-continuous unit_step function, i.e. where
>> unit_step(0)=1.
>>
>
> The z transform is defined for "sequences", not functions of a real
> variable.  It is unclear to me what you mean by left/right continuity
> in this context.

Apologies, those words were poorly chosen for this context.  It is
customary to describe variants of the unit step function in terms of
left or right continuity at x=0, but in this context it is clearer to
describe them by their values at x=0.

There are four common variants of the unit step function.  All agree
that step(x)=0 for x<0 and step(x)=1 for x>0.  The four common values
for step(0) are: 0, 1, 1/2, or unspecified.

For Maxima's built-in unit_step(x) function, unit_step(0)=0.

By the above definition of the unilateral Z-transform, the rule above is
incorrect.  The rule would be correct for a different variant of step
function, where step(0)=1.

>> However, given that unit_step(0)=0, this is the correct rule:
>>
>> ?defrule (r913_2b,
>> ? ? ?z_transform (unit_step (nn%), nn%, zz%),
>> ? ? ?1/(zz - 1));

I guess that when working with sequences, it is more convenient to work
with a step function for which step(0)=1.  In other cases, step(0)=1/2
or step(0)=0 may be more convenient.  That is why I am thinking about
how best to add support for other variants of the unit step function to
Maxima.

I will write more on that soon.

   Best,
    Mark