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;

}

}

}

相关推荐
RobinDevNotes5 小时前
一套代码发布到十几个平台:Cocos入门速览
typescript·c#·游戏开发
hanlin035 小时前
刷题笔记:力扣第32题-最长有效括号
笔记·算法·leetcode
All for pursuit.6 小时前
【动态规划-21】312.戳气球
数据结构·c++·算法·leetcode·动态规划
阿松爱学习7 小时前
【Unity开发】监听Scene场景事件
unity·c#
碧海银沙音频科技研究院8 小时前
基于炬芯ATS3089X自研AEC声学回声消除算法
算法
通问AI8 小时前
在两台 Mac Studio 上跑 800B 模型:MLX + RDMA over Thunderbolt 实测与四道门选型法
算法
ZywOo6238 小时前
《算法竞赛进阶指南》0x03 前缀和与差分
算法
Scintilla_y8 小时前
DAY2 滑动窗口
算法·leetcode·散列表
lvwangshu8 小时前
笛卡尔树
算法·图论
026d239 小时前
状态信号只知“其然”不知“其所以然”:变工况机械故障诊断的物理盲区
算法