[SciPy-user] problem with signal.residue
Kumar Appaiah
akumar@iitm.ac...
Tue Feb 13 19:06:07 CST 2007
On Tue, Feb 13, 2007 at 01:57:46PM -0600, Ryan Krauss wrote:
> I think I have found a small bug in signal.residue and may have found
> a simple solution. The problem seems to come from polydiv requiring
> that the numerator polynomial be of degree at most 1 less than the
> denominator. If I have a denominator of s^2+3*s+2, the numerator must
> have an s coefficient (even if that coefficient is 0) for
> signal.residue to work:
>
> In [75]: a
> Out[75]: array([1, 3, 2])
>
> In [76]: signal.residue([1],a)
> ---------------------------------------------------------------------------
> exceptions.ValueError Traceback (most recent cal
> last)
[snip]
> In [77]: signal.residue([0,1],a)
> Out[77]:
> (array([ 1.+0.j, -1.+0.j]),
> array([-1.+0.j, -2.+0.j]),
> array([], dtype=float64))
>
>
> I think the simple solution is to replace line 1056 with these four lines:
> if len(b)<len(a):
> k=[]
> else:
> k,b = polydiv(b,a)
>
> where the last line above is the old line 1056. Basically, specify
> that there is no k term if the len of b is less than the len of a.
>
> Is this too simple? What do I do to actually submit this if it is the
> right solution?
I think you are right. This seems to be a bug.
Please register and open a ticket at
http://projects.scipy.org/scipy/scipy and state the problem and the
specified solution.
Thanks.
Kumar
--
Kumar Appaiah,
462, Jamuna Hostel,
Indian Institute of Technology Madras,
Chennai - 600 036
More information about the SciPy-user
mailing list