On Wed, 13 Oct 2010 11:51:39 +0100
"Maas James Dr (MED)" <j.m...@uea.ac.uk> wrote:

> I've tried hard to find a way to exponentiate each element of a whole
> matrix such that if I start with A
> 
> A = [ 2   3
>       2   4]
> 
> I can get back B
> 
> B = [ 7.38   20.08
>       7.38   54.60]
> 
> I've tried
> 
> B <- exp(A) but no luck.

What have you tried exactly?  And with which version?  This should work
with all R versions that I am familiar with, e.g.:

R> A <- matrix(c(2,2,3,4),2,2)
R> A
     [,1] [,2]
[1,]    2    3
[2,]    2    4
R> B <- exp(A)
R> B
         [,1]     [,2]
[1,] 7.389056 20.08554
[2,] 7.389056 54.59815

Cheers,

        Berwin

========================== Full address ============================
Berwin A Turlach                      Tel.: +61 (8) 6488 3338 (secr)
School of Maths and Stats (M019)            +61 (8) 6488 3383 (self)
The University of Western Australia   FAX : +61 (8) 6488 1028
35 Stirling Highway                   
Crawley WA 6009                e-mail: ber...@maths.uwa.edu.au
Australia                        http://www.maths.uwa.edu.au/~berwin

______________________________________________
R-help@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.

Reply via email to