C#,数值计算——Logisticdev的计算方法与源程序

 

1 文本格式

using System;

namespace Legalsoft.Truffer
{
    ///


    /// Structure for logistic deviates.
    ///

    public class Logisticdev : Ran
    {
        private double mu { get; set; }
        private double sig { get; set; }

        ///


        /// Constructor arguments are mu and sig random sequence seed.
        ///

        ///
        ///
        ///
        public Logisticdev(double mmu, double ssig, ulong i) : base(i)
        {
            this.mu = mmu;
            this.sig = ssig;
        }

        public double dev()
        {
            double u;
            do
            {
                u = doub();
            } while (Math.Abs(u * (1.0 - u)) <= float.Epsilon);// (u * (1.0 - u) == 0.0);            
            return mu + 0.551328895421792050 * sig * Math.Log(u / (1.0 - u));
        }
    }
}
 

2 代码格式

using System;

namespace Legalsoft.Truffer
{
    /// 
    /// Structure for logistic deviates.
    /// 
    public class Logisticdev : Ran
    {
        private double mu { get; set; }
        private double sig { get; set; }

        /// 
        /// Constructor arguments are mu and sig random sequence seed.
        /// 
        /// 
        /// 
        /// 
        public Logisticdev(double mmu, double ssig, ulong i) : base(i)
        {
            this.mu = mmu;
            this.sig = ssig;
        }

        public double dev()
        {
            double u;
            do
            {
                u = doub();
            } while (Math.Abs(u * (1.0 - u)) <= float.Epsilon);// (u * (1.0 - u) == 0.0);            
            return mu + 0.551328895421792050 * sig * Math.Log(u / (1.0 - u));
        }
    }
}

你可能感兴趣的:(C#数值计算,Numerical,Recipes,c#,算法,哈希算法,开发语言)