我想得到以下列表的总和:
library(Rmpfr)
n <- 50
j <- 25
#1
sigma <- 0.3
theta <- 25
m <- 20
k <- 8
CgenC <- function(n,k,sigma){
i <- 0:k
B <- (-1)^i *choose(k,i)*pochMpfr((-i)*sigma, n)
CgenC <- sum(B)*1/(factorial(k))
return(CgenC)
}
h <- sapply(i,CgenC,k=k,sigma=sigma)
sum(h)
由于我使用的是&#39; Rmpfr,h是一个列表,如下所示:
> h
[[1]]
1 'mpfr' number of precision 424 bits
[1] 6.56100000001090797674407895165123852486764558494011370343385553818846334039114391208397490584873828362680520137726767534538684455e-5
[[2]]
1 'mpfr' number of precision 477 bits
[1] 0.00165337200000076007515956849631156412592784160499700109400458694583908280540322124291285331063187104152797429852422246700297812973405724306364625
... and so on
如何获取h中值的总和? 提前谢谢!