# Example 2(a) from end of Sec. 5.2 notes: f.t<-function(t){ .0625*exp(-.0625*t)*(.05/(.05-.0625))*(.1/(.1-.0625)) + .05*exp(-.05*t)*(.0625/(.0625-.05))*(.1/(.1-.05)) + .1*exp(-.1*t)*(.0625/(.0625-.1))*(.05/(.05-.1)) } integrate(f.t, lower=0, upper=30) # Example 2(b) from end of Sec. 5.2 notes: fY.t<-function(t){ ( .0625*exp(-.0625*t) )*0.2 + ( .0625*exp(-.0625*t)*(.05/(.05-.0625)) + .05*exp(-.05*t)*(.0625/(.0625-.05)) )*0.3 + ( .0625*exp(-.0625*t)*(.05/(.05-.0625))*(.1/(.1-.0625)) + .05*exp(-.05*t)*(.0625/(.0625-.05))*(.1/(.1-.05)) + .1*exp(-.1*t)*(.0625/(.0625-.1))*(.05/(.05-.1)) )*0.5 } integrate(fY.t, lower=0, upper=30)