Skip to content
Prev 334799 / 398503 Next

Simplifying an expression with an integral

On Dec 24, 2013, at 9:39 AM, Aur?lien Philippot wrote:

            
Is boolean math more to your liking?

integr_both<- function(x){ 
                   (x < 50)*(1/x*dnorm(x))+
                   (x>= 50 & x<100)*(  1/(2*x-50)*dnorm(x) ) }
res_b<- integrate(integr_both, lower=1, upper=100)$value
[1] 0.1116587