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# 库?


基础教程推荐
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01