[R] R function that duplicates Octave's poly function?
David Winsemius
dwinsemius at comcast.net
Sat Nov 28 16:30:44 CET 2009
On Nov 28, 2009, at 10:28 AM, Jason Rupert wrote:
> Cool.
>
> Is one of the results the definitive function to use to mimic
> Octave's poly function?
yes
>
> There were about 10 returns, and none clearly identified themselves
> as the definitive functionality representing the poly capability, so
> any insight and clarification is appreciated.
>
>
>
>
>
> ----- Original Message ----
> From: David Winsemius <dwinsemius at comcast.net>
> To: Jason Rupert <jasonkrupert at yahoo.com>
> Cc: R-help at r-project.org
> Sent: Sat, November 28, 2009 9:23:23 AM
> Subject: Re: [R] R function that duplicates Octave's poly function?
>
>
> On Nov 28, 2009, at 9:33 AM, Jason Rupert wrote:
>
>>
>> By any chance is anyone aware of an R function that duplicates
>> Octave's poly function?
>>
>> Here is a description of Octave's poly function:
>>
>> Function File: poly (A)
>> If A is a square N-by-N matrix, `poly (A)' is the row vector of
>> the coefficients of `det (z * eye (N) - a)', the characteristic
>> polynomial of A. As an example we can use this to find the
>> eigenvalues of A as the roots of `poly (A)'.
>> roots(poly(eye(3)))
>> => 1.00000 + 0.00000i
>> => 1.00000 - 0.00000i
>> => 1.00000 + 0.00000i
>> In real-life examples you should, however, use the `eig'
>> function for computing eigenvalues.
>>
>> If X is a vector, `poly (X)' is a vector of coefficients of the
>> polynomial whose roots are the elements of X. That is, of C is a
>> polynomial, then the elements of `D = roots (poly (C))' are
>> contained in C. The vectors C andD are, however, not equal due
>> to sorting and numerical errors.
>>
>> Thanks again for any insights and feedback.
>
> RSiteSearch("characteristic polynomial")
>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>
>
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list