Hi,
Which R function I should use to obtain determinant of a matrix with real(and
complex) numbers?
Kalin
---------------------------------
Never miss a thing. Make Yahoo your homepage.
[[alternative HTML version deleted]]
On Nov 16, 2007 7:27 PM, kalin lagno <kalinlagno at yahoo.com> wrote:> Which R function I should use to obtain determinant of a matrix with real(and complex) numbers?For real matrices: ?det Paul
Hi, Kalin, maybe you need this? A=diag(4)+1 prod(diag(chol(A))^2) # it can help you get det(A) 2007/11/17, kalin lagno <kalinlagno at yahoo.com>:> Hi, > Which R function I should use to obtain determinant of a matrix with real(and complex) numbers? > > Kalin > > --------------------------------- > Never miss a thing. Make Yahoo your homepage. > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >
Hello Kalin
det() does not take a complex matrix as an argument.
To get the determinant of a complex matrix, use eigen():
mydet <- function(a){prod(eigen(a,only.values=TRUE)$values)}
a <- matrix(1:9,3,3)
a[1,1] <- 1i
mydet(a)
[List: can we not add the above, or something like it,
to the definition of det() so that it can deal with complex matrices?]
HTH
Robin
On 16 Nov 2007, at 19:27, kalin lagno wrote:
> Hi,
> Which R function I should use to obtain determinant of a matrix
> with real(and complex) numbers?
>
> Kalin
>
> ---------------------------------
> Never miss a thing. Make Yahoo your homepage.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743