有没有C#库可以执行Excel NORMINV功能? [英] Is there a C# library that will perform the Excel NORMINV function?

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

问题描述

我正在运行一些蒙特卡洛模拟,并广泛使用Excel功能 NORM.INV 使用Office Interrop。该函数有三个参数(概率,平均值,标准偏差),并返回累积分布的倒数。



我想将我的代码移动到网络应用程序中,但这将需要在服务器上安装Excel。 有没有人知道与NORM.INV具有同等功能的C#统计数据库?

解决方案

Meta.Numerics 具有您正在寻找的内容。以下是使用该库的代码:

 分配n =新的NormalDistribution(均值,standardDeviation); 
double x = n.InverseLeftProbability(probability);

如果您这样做是为了产生正常偏差,则GetRandomValue函数更快。 p>

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.

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 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);

If you are doing this in order to generate normal deviates, the GetRandomValue function is even faster.

这篇关于有没有C#库可以执行Excel NORMINV功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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