是否有一个C#库,将执行Excel的NORMINV函数? [英] Is there a C# library that will perform the Excel NORMINV function?

查看:651
本文介绍了是否有一个C#库,将执行Excel的NORMINV函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跑了一些 Monte Carlo模拟并广泛利用Excel函数的NORM.INV 的。此功能有三个参数(概率,平均值,标准偏差),并返回累积分布的逆。

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.

我想我的代码进入一个Web应用程序,但需要在服务器上安装Excel中。 是否有人知道一个C#统计库,具有同等功能NORM.INV?

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.

这篇关于是否有一个C#库,将执行Excel的NORMINV函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆