Dear R experts,

I am trying to find numerical solutions for an integral equation.


Here is an example:

I started by defining the integrand, as a function of x and C, where x is
the variable of integration and C is the parameter I am interested in:


integrand<- function(C,x){-((100000*x)^(-1)-(1000*x+C)^(-1))*
1/(0.20*sqrt(2*pi))*exp(-0.5*(x-0.10)/(0.20))^2)}


Then, I integrate with respect to x, and define an objective function
(output) with respect to C:


output<- function(C) integrate(integrand, C=C, lower=0, upper=Inf)$value


I would like all the values of C (if any) for which the integral is equal
to 0.

I did the following:


library(rootSolve)

uniroot.all(output, c(0,1000000))


but that does not work ("evaluation of function gave a result of wrong
length"). I cannot either plot the function using plot or curve. I don't
understand what is going on?

Thanks in advance for any advice!

Aurelien

        [[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