static void Main(string[] args) { Matrix RealMass = new Matrix(new double[,]{{1,2,3,4,5,6,7,8,9,10,10,9,8,7,6,5,4,3,2,1}}); Matrix Realdist = new Matrix(RealMass.body); Realdist.toProbabilty(); int samplingtime = 500000; Matrix RSdist = RejectionSampling(Realdist, samplingtime); Matrix IPdist = ImportanceSampling(Realdist, samplingtime); Matrix MCdist = MCMCSampling(Realdist, samplingtime); Matrix GBdist = GibbsSampling(Realdist, samplingtime); Console.WriteLine(Realdist.toStringSimply()); Console.WriteLine("Sampling Distribution by Rejection Sampling"); Console.WriteLine(RSdist.toStringSimply()); Console.WriteLine("distance between Real and Rejection Sampling"); Console.WriteLine((Realdist - RSdist).toStringSimply()); Console.WriteLine("Sampling Distribution by MCMC Sampling"); Console.WriteLine(MCdist.toStringSimply()); Console.WriteLine("distance between Real and MCMC Sampling"); Console.WriteLine((Realdist - MCdist).toStringSimply()); Console.WriteLine("Sampling Distribution by Gibbs Sampling"); Console.WriteLine(GBdist.toStringSimply()); Console.WriteLine("distance between Real and Rejection Sampling"); Console.WriteLine((Realdist - GBdist).toStringSimply()); Console.WriteLine("Sampling Distribution by Importants Sampling"); Console.WriteLine(IPdist.toStringSimply()); Console.WriteLine("distance between Real and Importants Sampling"); Console.WriteLine((Realdist - IPdist).toStringSimply()); Console.WriteLine("Results of Rejection, MCMC, Gibbs, Importants"); Console.Write((1000*(Realdist - RSdist) * (1000*(Realdist - RSdist)).trans()).toStringSimply()+","); Console.Write((1000 * (Realdist - MCdist) * (1000 * (Realdist - MCdist)).trans()).toStringSimply() + ","); Console.Write((1000 * (Realdist - GBdist) * (1000 * (Realdist - GBdist)).trans()).toStringSimply() + ","); Console.Write((1000 * (Realdist - IPdist) * (1000 * (Realdist - IPdist)).trans()).toStringSimply() + ","); }