Skip to content

solve integrate(,..) varying limits of integration

2 messages · Tonja Krueger, Dimitris Rizopoulos

#
Dear List,
Is there a way to solve

integrate(func.1,x, Inf) $value =0.05

by varying the lower limit of integration (x in the example above)?
So far I got:

r<- 0.730163
s<--2
func.1<- function(t) {1/(2*pi*sqrt(1-r^2))*exp(-1/(2*(1-r^2))*(s^2-2*r*s*t+t^2))}

I can change the lower limit manually, like:

integrate(func.1, -2.5, Inf) $value
[1] 0.05053265
integrate(func.1, -2.4, Inf) $value
[1] 0.04942731
integrate(func.1, -2.45, Inf) $value
[1] 0.05000923

but this is very time-consuming. So I was wondering if there is a better, preferably an automated way to solve the equation?

Thanks,
Tonja
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
#
have a look at uniroot(), e.g.,

ff <- function (low, r, s) {
     f <- function (t, r, s) {
         exp(-(s^2 - 2*r*s*t + t^2) / (2*(1-r^2))) / (2*pi*sqrt(1-r^2))
     }
     integrate(f, low, Inf, r = r, s = s)$value - 0.05
}

uniroot(ff, c(-3, -2), r = 0.730163, s = -2)$root


I hope it helps.

Best,
Dimitris
On 9/14/2010 9:15 AM, Tonja Krueger wrote: