C#,数值计算——指数分布(Expondist)的计算方法与源程序

using System;

namespace Legalsoft.Truffer

{

public class Expondist

{

private double bet { get; set; }

public Expondist(double bbet)

{

this.bet = bbet;

if (bet <= 0.0)

{

throw new Exception("bad bet in Expondist");

}

}

public double p(double x)

{

if (x < 0.0)

{

throw new Exception("bad x in Expondist");

}

return bet * Math.Exp(-bet * x);

}

public double cdf(double x)

{

if (x < 0.0)

{

throw new Exception("bad x in Expondist");

}

return 1.0 - Math.Exp(-bet * x);

}

public double invcdf(double p)

{

if (p < 0.0 || p >= 1.0)

{

throw new Exception("bad p in Expondist");

}

return -Math.Log(1.0 - p) / bet;

}

}

}

相关推荐
guygg885 分钟前
基于matlab的FIR滤波器
开发语言·算法·matlab
ysh988840 分钟前
PP-OCR:一款实用的超轻量级OCR系统
算法
遇雪长安1 小时前
差分定位技术:原理、分类与应用场景
算法·分类·数据挖掘·rtk·差分定位
数通Dinner1 小时前
RSTP 拓扑收敛机制
网络·网络协议·tcp/ip·算法·信息与通信
昏睡红猹2 小时前
C#脚本化(Roslyn):如何在运行时引入nuget包
c#
张人玉3 小时前
C# 常量与变量
java·算法·c#
weixin_446122464 小时前
LinkedList剖析
算法
就是有点傻4 小时前
在C#中,可以不实例化一个类而直接调用其静态字段
c#
软件黑马王子4 小时前
C#系统学习第八章——字符串
开发语言·学习·c#
阿蒙Amon4 小时前
C#读写文件:多种方式详解
开发语言·数据库·c#