Skip to content

Problem to solve an integral equation

4 messages · Aurélien Philippot, David Winsemius

#
On Dec 17, 2013, at 8:53 AM, Aur?lien Philippot wrote:

            
Error: unexpected ')' 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)"

Taking out the last parenthesis resulted in a variety of error messages including:
Error in integrate(integrand, C = C, lower = 0, upper = Inf) : 
  extremely bad integrand behaviour
Error in integrate(integrand, C = C, lower = 0, upper = Inf) : 
  the integral is probably divergent
Generally these problems are solved with the use of something along the lines of 

    sapply( seq(...), output)  # across an appropriate domain

Or using the `Vectorize` function.

But since you did not supply tested code for the integrand, I am not proceeding further.

-- 
david.
#
On Dec 17, 2013, at 11:25 AM, Aur?lien Philippot wrote:

            
As I said, the usual route is to use sapply or Vectorize and it is up to you to provide an approportiate domain,

Vout <- Vectorize(output)

# Your function does not appear to have a solution in the domain you are investigating:

which ( Vout(seq(0, 1000000, by=10000)  ) < 0  )
integer(0)

# So the output of uniroot.all seems appropriate:

uniroot.all(Vout, c(0,1000000))
numeric(0)