octave-maintainers
[Top][All Lists]
Advanced

[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: Mon, 08 Oct 2007 15:41:13 -0400

On  6-Oct-2007, Ben Abbott wrote:

| I've attached a modified residue.m that includes modifications to the  
| doc-string and the  addition of test scripts. In addition, the  
| multiplicity vector, "e", which the prior change dropped has been  
| reinstated.

OK, I applied this patch, but had to do some of it by hand since there
had been intervening formatting changes.  Would you please check the
current CVS version and make sure that it is correct?  In particular,
I am seeing the failure:

  octave:1> test residue
    ***** test
   b = [1, 0, 1];
   a = [1, 0, 18, 0, 81];
   [r, p, k, e] = residue(b, a);
   assert ((abs (54*r - [-5i; 12; 5i; 12]) < 1e-6
   && abs (p - [3i; 3i; -3i; -3i]) < 1e-7
   && isempty (k)
   && e == [1; 2; 1; 2]));
   [br, ar] = residue (r, p, k);
   assert ((abs (br - b) < 1e-12
   && abs (ar - a) < 1e-12));
  !!!!! test failed
  error: assert ((abs (54 * r - [-5i; 12; 5i; 12]) < 1e-6 && abs (p - [3i; 3i; 
-3i; -3i]) < 1e-7 && isempty (k) && e == [1; 2; 1; 2])) failed
  octave:2> b = [1, 0, 1];
  octave:3> a = [1, 0, 18, 0, 81];
  octave:4>  [r, p, k, e] = residue(b, a);
  octave:5> abs (54*r - [-5i; 12; 5i; 12])
  ans =

     1.0000e+01
     4.4460e-08
     1.0000e+01
     4.4460e-08

and I'm not sure whether it is the test that is bad, or residue that
is computing the wrong result.

| The test scripts include the examples give in the doc-string as well  
| as the original error which recently prompted much discussion and  
| lead to my involvement. The accuracy of the residues may have been  
| impacted. I had to lower the increase the permitted error in the test  
| scripts in order for the scripts to pass ... at least relative to the  
| test script in your prior email. Specifically
| 
|       -%! assert ((abs (r - [-2; 7; 3]) < 1e-7
|       +%! assert ((abs (r - [-2; 7; 3]) < 1e-5
| 
| It occurs to me that I need to get set up with CVS so I can see the  
| present state of things. That way I can send patches instead of  
| sources ... unfortunately the web-site, http://www.octave.org/ 
| download.html, is down. I'll get to that task when it's back up.

I should be up again.

| In any event, I've attached a new residue.m as well as the equivalent  
| patch (which may have a unix/dos EOL problem). I've also attached a  
| ChangeLog.
| 
| Some questions,
| 
| (1) Is there a naming convention for patches?

No the name doesn't matter, but it is helpful if you send them as
plain text attachments so I can apply them directly from Emacs instead
of having to save them to a file.

| (2) Which variety of EOL is desired, or does it matter?

The files should have Unix line endings (LF only), but I don't think
that matters if you send text/plain attachments.

thanks,

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]