[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with residue and repeated complex roots
From: |
Ben Abbott |
Subject: |
Re: problem with residue and repeated complex roots |
Date: |
Tue, 27 Nov 2007 20:58:39 -0500 |
ok, I checked my local Octave 2.9.17 (which I have some trouble
with), and I checked Matlab 7.3
-------------------------------------
octave:2> n = 1;
octave:3> d = [1 8 42 104 169];
octave:4> roots(d)
ans =
-2.0000 + 3.0000i
-2.0000 - 3.0000i
-2.0000 + 3.0000i
-2.0000 - 3.0000i
octave:5> [a b c] = residue(n,d)
a =
3.9416e-18 - 9.2593e-03i
-2.7778e-02 - 5.6372e-10i
-2.3130e-18 + 9.2593e-03i
-2.7778e-02 + 5.6372e-10i
b =
-2.0000 + 3.0000i
-2.0000 + 3.0000i
-2.0000 - 3.0000i
-2.0000 - 3.0000i
c = [](0x0)
-------------------------------------
For Matlab 7.3 on Mac OSX I get (essentially) the same result.
-------------------------------------
n = 1;
>> d = [1 8 42 104 169];
>> roots(d)
ans =
-2.000000031975913 + 3.000000067504366i
-2.000000031975913 - 3.000000067504366i
-1.999999968024083 + 2.999999932495634i
-1.999999968024083 - 2.999999932495634i
>> [a,b,c] = residue(n,d)
a =
-0.000000000000000 - 0.009259259259259i
-0.027777777777778 + 0.000000000000000i
-0.000000000000000 + 0.009259259259259i
-0.027777777777778 - 0.000000000000000i
b =
-1.999999999999998 + 3.000000000000000i
-1.999999999999998 + 3.000000000000000i
-1.999999999999998 - 3.000000000000000i
-1.999999999999998 - 3.000000000000000i
c =
[]
-------------------------------------
My results agree with your Octave results, but not with your Matlab.
What version of Matlab are you using.
Ben
p.s. sorry for not looking at the detail earlier
On Nov 27, 2007, at 8:42 PM, Doug Stewart wrote:
I downloaded from
http://velveeta.che.wisc.edu/cgi-bin/cvsweb.cgi/~checkout~/octave/
scripts/polynomial/residue.m?rev=1.35;content-type=text%2Fplain
and it does use mpoles.m
but I still get
> [a b c]=residue(n,d)
ver = 1.35
a =
-9.3613e-018 - 9.2593e-003i
-2.7778e-002 - 5.3894e-010i
2.3130e-018 + 9.2593e-003i
-2.7778e-002 + 5.3894e-010i
b =
-2.0000 + 3.0000i
-2.0000 + 3.0000i
-2.0000 - 3.0000i
-2.0000 - 3.0000i
c = [](0x0)
To prove that I was using the new file and not an older file I
added a line to print out the ver. number.
Please test this on your machine.
Doug Stewart
Doug Stewart wrote:
Thanks
Doug
Ben Abbott wrote:
Doug,
This problem was addressed with a change that made it into
2.9.16. If you check the cvs you can replace your residue.m with
the one there. You'll need mpoles.m as well.
I should also mention that another bug/feature was fixed just
yesterday.
Ben
On Nov 27, 2007, at 5:11 PM, Doug Stewart wrote:
I am running qtoctave on windows XP octave version 2.9.15
residue doesn't give the correct answer for repeated complex roots
her is Matlab's result
» n
n =
1
» d
d =
1 8 42 104 169
» roots(d)
ans =
-2.0000+ 3.0000i
-2.0000- 3.0000i
-2.0000+ 3.0000i
-2.0000- 3.0000i
» [a b c]=residue(n,d)
a =
1.0e+005 *
1.2662+ 1.8232i
1.2662- 1.8232i
-1.2662- 1.8232i
-1.2662+ 1.8232i
b =
-2.0000+ 3.0000i
-2.0000- 3.0000i
-2.0000+ 3.0000i
-2.0000- 3.0000i
c =
[]
and qtoctave's results
n
n = 1
d
d =
1 8 42 104 169
roots(d)
ans =
-2.0000 + 3.0000i
-2.0000 - 3.0000i
-2.0000 + 3.0000i
-2.0000 - 3.0000i
[a b c]=residue(n,d)
a =
-9.3613e-018 - 9.2593e-003i
-2.7778e-002 - 5.3894e-010i
2.3130e-018 + 9.2593e-003i
-2.7778e-002 + 5.3894e-010i
b =
-2.0000 + 3.0000i
-2.0000 + 3.0000i
-2.0000 - 3.0000i
-2.0000 - 3.0000i
c = [](0x0)
I haven't looked into why this is happening yet.
Doug Stewart
_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave
_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave