C#,数值计算——指数微分(exponential deviates)的计算方法与源程序

1 文本格式

using System;

namespace Legalsoft.Truffer
{
    ///


    /// 指数偏差
    /// Structure for exponential deviates.
    ///

    public class Expondev : Ran
    {
        private double beta { get; set; }

        ///


        /// Constructor arguments are beta and a random sequence seed.
        ///

        ///
        ///
        public Expondev(double bbeta, ulong i) : base(i)
        {
            this.beta = bbeta;
        }

        ///


        /// Return an exponential deviate.
        ///

        ///
        public double dev()
        {
            double u;
            do
            {
                u = doub();
            } while (Math.Abs(u) <= float.Epsilon);// (u == 0.0);        
            return -Math.Log(u) / beta;
        }
    }
}
 

2 代码格式

using System;

namespace Legalsoft.Truffer
{
    /// 
    /// 指数偏差
    /// Structure for exponential deviates.
    /// 
    public class Expondev : Ran
    {
        private double beta { get; set; }

        /// 
        /// Constructor arguments are beta and a random sequence seed.
        /// 
        /// 
        /// 
        public Expondev(double bbeta, ulong i) : base(i)
        {
            this.beta = bbeta;
        }

        /// 
        /// Return an exponential deviate.
        /// 
        /// 
        public double dev()
        {
            double u;
            do
            {
                u = doub();
            } while (Math.Abs(u) <= float.Epsilon);// (u == 0.0);        
            return -Math.Log(u) / beta;
        }
    }
}

你可能感兴趣的:(C#数值计算,Numerical,Recipes,开发语言,c#,入门教程,初学,算法)