Hi,
 
I would like to write a function for this formula:
F(a,b,c,z)=1+(ab)/(1!c)+ +(a(a+1)b(b+1))/(2!c(c+1))+ 
+(a(a+1)(a+2)b(b+1)(b+2))/(3!c(c+1)(c+2))+…
  
I wrote this function but not sure what is not right:
 
hypergeo_sum <- function (a,b,c,z,n)
{ for (i in 1:n)
  { aa <- 1+(a*b*z)/c
  aa[i] <- (aa-1)*(a+i)*(b+i)*z/((i+1)*(c+i))
  comb_sum <- aa + aa[i]+ aa[i+2]
  }
  comb_sum
}
 
hypergeo_sum (1.25,1.75,1.25,0.5,3)
 
output:
> hypergeo_sum (1.25,1.75,1.25,0.5,3)
[1] 2.394531       NA 1.039062

 
The answer should be 2.852539.
 
Or can you suggest any R book that I can refer to. Thank you so much for your 
help.




______________________________________________
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