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;

}

}

}

相关推荐
rockey62731 分钟前
基于AScript的Lua脚本语言发布啦
c#·.net·lua·script·动态脚本
lsylalalala2 小时前
常见的排序算法1
数据结构·算法·排序算法
想吃火锅10053 小时前
【leetcode】54. 螺旋矩阵
算法·leetcode·矩阵
想吃火锅10053 小时前
【leetcode】300. 最长递增子序列
算法·leetcode·职场和发展
imaol13 小时前
数据结构---队列
java·数据结构·算法
数模竞赛Paid answer3 小时前
2026年电工杯数学建模A题绿电直连型电氢氨园区优化运行求解全过程论文及程序
算法·数学建模·电工杯
疯狂打码的少年3 小时前
【数据结构】串的模式匹配:KMP算法(重点)
数据结构·笔记·算法
半亩码田3 小时前
【.NET新特性·第11篇】C# 14 字段属性:告别手写 backing field
java·c#·.net
曹牧3 小时前
C#:问号
前端·数据库·c#
少控科技4 小时前
农场设备管理代码(2)
开发语言·c#