[SciPy-dev] accuracy problem in filterdesign.py

Heiko Henkelmann heiko at hhenkelmann.de
Sun Mar 24 16:38:32 EST 2002


Hello,

while writing a test driver for a minimum phase calculation routine I came
across the following problem. It is causing asymmetriesin the output of
freqz. In line 107 and 109 in filter_design.py the follwoing is happening:


>>> N=512
>>> lastpoint=2*pi
>>> w1=arange(0,lastpoint,lastpoint/N)
>>> w2=arange(0,N)*(lastpoint/N)
>>> lastpoint-w1[511]-w1[1]
-6.3546390371982397e-014
>>> lastpoint-w2[511]-w2[1]
4.0245584642661925e-016
>>> w1[511]
6.2709134608765646
>>> w2[511]
6.2709134608765007
>>> w2[511]-w1[511]
-6.3948846218409017e-014
>>>


It appears that arange for floating point values is accumulating an error
during summation. Do you think it would be worthwhile to tweak
filter_design.py to work around this problem?


Heiko





More information about the SciPy-Dev mailing list