help-octave
[Top][All Lists]
Advanced

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

Re: problem with consistency of root finding and sorting


From: David Bateman
Subject: Re: problem with consistency of root finding and sorting
Date: Wed, 10 Oct 2007 13:55:26 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Ben Abbott wrote:
>
> On Oct 10, 2007, at 3:45 AM, David Bateman wrote:
>
>> Ben Abbott wrote:
>>>
>>> Thanks David,
>>>
>>> another attempt, if you don't mind
>>>
>>> p = roots([1 0 18 0 81])
>>> p =
>>>
>>>   -0.0000 + 3.0000i
>>>   -0.0000 - 3.0000i
>>>    0.0000 + 3.0000i
>>>    0.0000 - 3.0000i
>>>
>> octave:1> p = roots([1 0 18 0 81])
>> p =
>>
>>    0.0000 + 3.0000i
>>    0.0000 - 3.0000i
>>   -0.0000 + 3.0000i
>>   -0.0000 - 3.0000i
>>
>>> [e, indx] = mpoles (p)
>>> e =
>>>
>>>    1
>>>    2
>>>    1
>>>    2
>>>
>>> indx =
>>>
>>>    1
>>>    3
>>>    2
>>>    4
>>
>> octave:2> [e, indx] = mpoles (p)
>> e =
>>
>>    1
>>    2
>>    1
>>    2
>>
>> indx =
>>
>>    2
>>    4
>>    1
>>    3
>>
>>>
>>> p(indx)
>>> ans =
>>>
>>>   -0.0000 + 3.0000i
>>>    0.0000 + 3.0000i
>>>   -0.0000 - 3.0000i
>>>    0.0000 - 3.0000i
>>>
>> octave:3> p(indx)
>> ans =
>>
>>    0.0000 - 3.0000i
>>   -0.0000 - 3.0000i
>>    0.0000 + 3.0000i
>>   -0.0000 + 3.0000i
>>
>
> Thanks again. I believe I've found the bug ... and it is mine :-(
>
> Using the attached mpoles.m, I get
>
> p = roots([1 0 18 0 81])
> p =
>
>   -0.0000 + 3.0000i
>   -0.0000 - 3.0000i
>    0.0000 + 3.0000i
>    0.0000 - 3.0000i
>
> [e, indx] = mpoles(p)
> e =
>
>    1
>    2
>    1
>    2
>
> indx =
>
>    1
>    3
>    2
>    4
>
> I assume you will get the same.
>
>
>
Ok with the attached mpoles at the latest CVS I get

octave:1> p = roots([1 0 18 0 81])
p =

   0.0000 + 3.0000i
   0.0000 - 3.0000i
  -0.0000 + 3.0000i
  -0.0000 - 3.0000i

octave:2> [e, indx] = mpoles(p)
e =

   1
   2
   1
   2

indx =

   3
   1
   4
   2

octave:3> p(indx)
ans =

  -0.0000 + 3.0000i
   0.0000 + 3.0000i
  -0.0000 - 3.0000i
   0.0000 - 3.0000i


D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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