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;

}

}

}

相关推荐
余额瞒着我当琳4 分钟前
C++多态深入解析:多态概念,多态实现条件,虚函数表与内存分布,常见问题及注意事项
c++·算法
geovindu9 分钟前
CSharp:Condition Variable Pattern
后端·设计模式·c#·.net·.netcore·条件变量模式·同步型模式
维克兜率天11 分钟前
【维克】模块3总结:从一行空数据,到一个能跑的模型
python·深度学习·算法
飞Link16 分钟前
定积分理论与 Python 仿真完全指南
python·算法
闲研随记43 分钟前
RL算法学习:ArgMaxRL
算法·llm·强化学习·rl
飞Link1 小时前
零基础:离散数据积分与 Python 实现保姆级教程
python·算法
淡海水1 小时前
11-03-Unity-List-T-和Dictionary-TKey-TValue-的性能调优实战
算法·unity·c#·list·dictionary
土司大王1 小时前
LeetCode hot100——394.字符串解码:Java 双栈模拟
java·算法·leetcode
a187927218311 小时前
【算法】双指针与滑动窗口(三):相向双指针——比较、排除、收缩
算法·leetcode·双指针·滑动窗口·原理·相向双指针·算法讲解