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;

}

}

}

相关推荐
2301_800895109 分钟前
信息安全数学基础复习
算法
爱折腾的小黑牛17 分钟前
简记往来批量录入功能的实现:从文本到结构化数据
前端·算法
Starmoon_dhw32 分钟前
题解:P17078 夏日甜点
c++·学习·算法·图论
海石1 小时前
【JS击败90%】前缀和+定长滑动窗口
算法·leetcode
Tisfy1 小时前
LeetCode 2685.统计完全连通分量的数量:DFS求每个连通块的边点数
算法·leetcode·深度优先··题解·连通图·全连通分量
海石2 小时前
1次遍历,空间复杂度击败100%,时间复杂度击败85%
算法·leetcode
旋律翼22 小时前
Qt Bridges for C# 深度技术解析
开发语言·qt·c#
L歪歪君2 小时前
Apache Doris全链路性能优化实战指南:从架构设计到生产落地
java·开发语言·算法
m0_466525292 小时前
从“算法内卷”到“可信易用” 东软多模态医学人工智能平台开启无代码科研新时代
人工智能·算法
码少女3 小时前
数据结构——冒泡排序及优化
数据结构·算法·排序算法