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# 库?
基础教程推荐
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
