P(X= i )= p (i )
X一世0 ,1 ,... ,ñ(0 ,1 / 6 ,1 / 6 ,1 / 6 ,1 / 6 ,1 / 6 ,1 / 6 )p(t)=∑60p(i)tiq(j)j0,1,…,mp(t)q(t)
> p <- q <- c(0, rep(1/6,6))
> pq <- convolve(p,rev(q),type="open")
> zapsmall(pq)
[1] 0.00000000 0.00000000 0.02777778 0.05555556 0.08333333 0.11111111
[7] 0.13888889 0.16666667 0.13888889 0.11111111 0.08333333 0.05555556
[13] 0.02777778
然后您可以检查一下是否正确(手动计算)。现在对于真正的问题,五个骰子分别有4,6,8,12,20面。我将假设每个骰子的概率均等进行计算。然后:
> p1 <- c(0,rep(1/4,4))
> p2 <- c(0,rep(1/6,6))
> p3 <- c(0,rep(1/8,8))
> p4 <- c(0, rep(1/12,12))
> p5 <- c(0, rep(1/20,20))
> s2 <- convolve(p1,rev(p2),type="open")
> s3 <- convolve(s2,rev(p3),type="open")
> s4 <- convolve(s3,rev(p4),type="open")
> s5 <- convolve(s4, rev(p5), type="open")
> sum(s5)
[1] 1
> zapsmall(s5)
[1] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00002170
[7] 0.00010851 0.00032552 0.00075955 0.00149740 0.00262587 0.00421007
[13] 0.00629340 0.00887587 0.01191406 0.01534288 0.01907552 0.02300347
[19] 0.02699653 0.03092448 0.03465712 0.03808594 0.04112413 0.04370660
[25] 0.04578993 0.04735243 0.04839410 0.04891493 0.04891493 0.04839410
[31] 0.04735243 0.04578993 0.04370660 0.04112413 0.03808594 0.03465712
[37] 0.03092448 0.02699653 0.02300347 0.01907552 0.01534288 0.01191406
[43] 0.00887587 0.00629340 0.00421007 0.00262587 0.00149740 0.00075955
[49] 0.00032552 0.00010851 0.00002170
> plot(0:50,zapsmall(s5))
该图如下所示:
现在,您可以将此精确解决方案与仿真进行比较。