octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53869] Residue returning an inaccurate result


From: Rik
Subject: [Octave-bug-tracker] [bug #53869] Residue returning an inaccurate result
Date: Mon, 14 May 2018 19:43:11 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #7, bug #53869 (project octave):

I think this is the correct thing to do.  However, when I make the change and
then run "test residue" I get a failure in the BIST tests.


octave:14> test residue
***** test
 b = [1, 0, 1];
 a = [1, 0, 18, 0, 81];
 [r, p, k, e] = residue (b, a);
 r1 = [-5i; 12; +5i; 12]/54;
 p1 = [+3i; +3i; -3i; -3i];
 assert (r, r1, 1e-12);
 assert (p, p1, 1e-12);
 assert (isempty (k));
 assert (e, [1; 2; 1; 2]);
 [br, ar] = residue (r, p, k);
 assert (br, [0,b], 1e-12);
 assert (ar, a, 1e-12);
!!!!! test failed
ASSERT errors for:  assert (br,[0, b],1e-12)

  Location  |  Observed  |  Expected  |  Reason
     .          O(1x3)       E(1x4)      Dimensions don't match


The issue is that the call


 [br, ar] = residue (r, p, k);


used produce a 4-element vector


[ 0, 1, 0, 1]


Now it produces just a 3-element vector 


[ 1, 0, 1]


Given that this vector represents a polynomial, it seems better that the
leading 0 should be removed.

@Tony: Could you check that Matlab produces a 3-element vector for the code
above?


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53869>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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