On Dec 9, 2007, at 12:23 PM, Doug Stewart wrote:
I would like Ben Abbott to try the following code
n=poly([ -11 -10 ])*1000
d=poly([ -3-3j -3+3j -3-3j -3+3j -3-3j -3+3j -5.6 -1 ])
roots(d)
residue(n,d)
I get
p =
-5.60000 + 0.00000i
-3.00010 + 3.00003i
-3.00010 - 3.00003i
-2.99992 + 3.00007i
-2.99992 - 3.00007i
-2.99998 + 2.99990i
-2.99998 - 2.99990i
-1.00000 + 0.00000i
ans =
-1.3195 - 0.0000i
-3.7935 + 8.3944i
14.5612 + 10.6427i
16.3548 - 13.2580i
-3.7935 - 8.3944i
14.5612 - 10.6427i
16.3548 + 13.2580i
8.9065 - 0.0000i
but it should be:
p =
-5.60000 + 0.00000i
-3.00010 + 3.00003i
-3.00010 - 3.00003i
-2.99992 + 3.00007i
-2.99992 - 3.00007i
-2.99998 + 2.99990i
-2.99998 - 2.99990i
-1.00000 + 0.00000i
ans =
-1.3195 - 0.0000i
-3.7935 + 8.3944i
-3.7935 - 8.3944i
14.5612 + 10.6427i
14.5612 - 10.6427i
16.3548 - 13.2580i
16.3548 + 13.2580i
8.9065 - 0.0000i
Could you verify what I am getting please.?
Doug Stewart
Doug, I took your example and modified it slightly. Please see the
attached test script. The script displays [r, p]
I've run the script from Octave on Tiger/PPC and Leopard/Intel, as
well as on Matlab 7.3b. In each case I get the same results (except
that matlab appears to refine the roots a bit better).
---------------------------
octave:30> test
ans =
-1.31921 + 0.00000i -5.60000 + 0.00000i
-3.79336 + 8.39318i -2.99998 + 3.00009i
14.55944 + 10.64154i -3.00008 + 2.99997i
16.35697 - 13.24746i -2.99994 + 2.99994i
-3.79336 - 8.39318i -2.99998 - 3.00009i
14.55944 - 10.64154i -3.00008 - 2.99997i
16.35697 + 13.24746i -2.99994 - 2.99994i
8.90592 - 0.00000i -1.00000 + 0.00000i
---------------------------
The Matlab result is
---------------------------
>> test
ans =
-1.3195 -5.6000
-3.7929 + 8.3933i -3.0000 + 3.0000i
14.5590 +10.6397i -3.0000 + 3.0000i
16.3510 -13.2508i -3.0000 + 3.0000i
-3.7929 - 8.3933i -3.0000 - 3.0000i
14.5590 -10.6397i -3.0000 - 3.0000i
16.3510 +13.2508i -3.0000 - 3.0000i
8.9054 -1.0000
---------------------------
It appears to me that Octave and Matlab's residue.m script work in
compatible/consistent ways ... hmmm, perhaps I've misinterpreted your
point?
I'm on a tight schedule today, so I don't have time for doing a
derivation by hand to verify the results. My presence online will be
spotty for the next few days, but will check back when I can.
Ben
------------------------------------------------------------------------