Is there a C# library that will perform the Excel NORMINV function?(是否有执行 Excel NORMINV 函数的 C# 库?)
问题描述
我正在运行一些蒙特卡罗模拟并广泛使用 Excel 函数NORM.INV 使用 Office Interrop.此函数采用三个参数(概率、平均值、标准差)并返回累积分布的倒数.
I'm running some Monte Carlo simulations and making extensive use of the Excel function NORM.INV using Office Interrop. This functions takes three arguments (probability, average, standard deviation) and returns the inverse of the cumulative distribution.
我想将我的代码移动到网络应用程序中,但这需要在服务器上安装 Excel.有谁知道与 NORM.INV 具有等效功能的 C# 统计库吗?
I'd like to move my code into a web app, but that will require installing Excel on the server. Does anybody know of a C# statistics library that has an equivalent function to NORM.INV?
推荐答案
Meta.Numerics 正是您要寻找的.这是使用该库执行此操作的代码:
Meta.Numerics has exactly what you are looking for. Here is the code to do it using that library:
Distribution n = new NormalDistribution(mean, standardDeviation);
double x = n.InverseLeftProbability(probability);
如果您这样做是为了生成法线偏差,GetRandomValue 函数会更快.
If you are doing this in order to generate normal deviates, the GetRandomValue function is even faster.
这篇关于是否有执行 Excel NORMINV 函数的 C# 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否有执行 Excel NORMINV 函数的 C# 库?


- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01