options(scipen=999)
options(digits=9)
cat("\014") # clear screen
rm(list=ls(all=TRUE))

mue=50
s=10
p=function(a,b) pnorm(b,mue,s)-pnorm(a,mue,s)
p(45,62)

mue=3
s=0.5
pnorm(2.3,mue,s)

mue=800
s=40
p=function(a,b) pnorm(b,mue,s)-pnorm(a,mue,s)
p(778,834)

mue=40
s=2
1-pnorm(43,mue,s)

mue=40
s=2
1-pnorm(43.5,mue,s)

mue=2.1
s=1.2
p=function(a,b) pnorm(b,mue,s)-pnorm(a,mue,s)
p(2.45,3.55)

mue=15*0.4;mue
s=sqrt(15*0.4*0.6);s
p=function(a,b) pnorm(b,mue,s)-pnorm(a,mue,s)
p(3.5,4.5)
pnorm(-1.32)
pnorm(-0.79)
pnorm(-0.79)-pnorm(-1.32)

mue=15*0.4;mue
s=sqrt(15*0.4*0.6);s
p=function(a,b) pnorm(b,mue,s)-pnorm(a,mue,s)
p(6.5,9.5)
pnorm(1.84)
pnorm(0.26)
pnorm(1.84)-pnorm(0.26)

n=100
p=0.1
mue=n*p;mue
s=sqrt(n*p*(1-p));s
1-pnorm(13.5,mue,s)

n=80
p=0.25
mue=n*p;mue
s=sqrt(n*p*(1-p));s
pnorm(30.5,mue,s)-pnorm(24.5,mue,s)
pnorm(2.71,0,1)
pnorm(1.16,0,1)
pnorm(2.71,0,1)-pnorm(1.16,0,1)

