[R] R det

Robin Hankin r.hankin at noc.soton.ac.uk
Mon Nov 19 09:53:53 CET 2007


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



More information about the R-help mailing list