I am trying to solve an integral in R. However, I am getting an error when
I am trying to solve for that integral.

The equation that I am trying to solve is as follows:

$$ C_m = \frac{{abs{x}}e^{2x}}{\pi^{1/2}}\int_0^t t^{-3/2}e^{-x^2/t-t}dt $$

[image: enter image description here]

The code that I am using is as follows:

a <- seq(from=-10, by=0.5,length=100)
## Create a function to compute integrationCfun <- function(XX, upper){
  integrand <- function(x)x^(-0.5)*exp((-XX^2/x)-x)
  integrated <- integrate(integrand, lower=0, upper=upper)$value
  (final <- abs(XX)*pi^(-0.5)*exp(2*XX)*integrated) }


b<- sapply(a, Cfun, upper=1)

The error that I am getting is as follows:

Error in integrate(integrand, lower = 0, upper = upper) :
  the integral is probably divergent

Does this mean I cannot solve the integral ?

Any possible ways to fix this problem will be highly appreciated.The
question can be found on
http://stackoverflow.com/questions/15892586/solving-an-integral-in-r-gives-error-the-integral-is-probably-divergent
 also.

Thanks.

        [[alternative HTML version deleted]]

______________________________________________
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