[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: modified residues() for matlab compatibility
From: |
John W. Eaton |
Subject: |
Re: modified residues() for matlab compatibility |
Date: |
Tue, 09 Oct 2007 20:20:26 -0400 |
On 9-Oct-2007, Ben Abbott wrote:
| In any event, the patch below should work.
It still failed to apply cleanly for me. I think the problem is the
lines of context that are indented in the second part of the patch. I
don't know why that is happening since they don't seem to be indented
in the CVS archive. In any case, I think I have it applied by hand
now.
| +%!test
| +%! b = [1, 0, 1];
| +%! a = [1, 0, 18, 0, 81];
| +%! [r, p, k, e] = residue(b, a);
| +%! r1 = [-5i; 12; +5i; 12]/54;
| +%! r2 = conj(r1);
| +%! p1 = [+3i; +3i; -3i; -3i];
| +%! p2 = conj(p1);
| +%! assert ((((abs (r - r1) < 1e-7) && (abs (p - p1) < 1e-7))
| +%! || ((abs (r - r2) < 1e-7) && (abs (p - p2) < 1e-7)))
I don't think we should have either/or tests like this. I suppose
both results are correct since it is only the ordering that is
different, but isn't the ordering supposed to be the same on all
systems? Or is the problem the numerical accuracy of the solution? I
see the following here:
octave:4> format long
octave:5> r
error: `r' undefined near line 5 column 1
octave:5> b = [1, 0, 1];
octave:6> a = [1, 0, 18, 0, 81];
octave:7> [r, p, k, e] = residue(b, a);
octave:8> r
r =
-0.000000000000000 + 0.092592593063067i
0.222222221398891 - 0.000000000000000i
-0.000000000000000 - 0.092592593063067i
0.222222221398892 + 0.000000000000000i
What happens on your system?
Also note that the values we are comparing this with are
-0.000000000000000 - 0.092592592592593i
0.222222222222222 + 0.000000000000000i
0.000000000000000 + 0.092592592592593i
0.222222222222222 + 0.000000000000000i
so is there also a signed zero problem involved here?
jwe
- Re: modified residues() for matlab compatibility, (continued)
- Re: modified residues() for matlab compatibility, Ben Abbott, 2007/10/05
- Re: modified residues() for matlab compatibility, John W. Eaton, 2007/10/06
- Re: modified residues() for matlab compatibility, John W. Eaton, 2007/10/06
- Re: modified residues() for matlab compatibility, Ben Abbott, 2007/10/06
- Re: modified residues() for matlab compatibility, Ben Abbott, 2007/10/06
- Message not available
- Re: modified residues() for matlab compatibility, Ben Abbott, 2007/10/06
- Re: modified residues() for matlab compatibility, John W. Eaton, 2007/10/08
- Re: modified residues() for matlab compatibility, Ben Abbott, 2007/10/08
- Re: modified residues() for matlab compatibility, John W. Eaton, 2007/10/09
- Re: modified residues() for matlab compatibility, Ben Abbott, 2007/10/09
- Re: modified residues() for matlab compatibility,
John W. Eaton <=