c# 标准正太分布函数,在C#标准正态分布z值函数

I been looking at the recent blog post by Jeff Atwood on Alternate Sorting Orders. I tried to convert the code in the post to C# but I ran into an issue. There is no function in .NET that I know of that will return the z-value, given the percentage of area under the standard normal curve. The recommended values to use for the algorithm are 95% and 97.5% which you can look up on the z-value table in any statistics book.

Does anyone know how to implement such a function for all values of z or at least to 6 standard deviations from the mean. One way would be to hard code the values into a dictionary and use a look up but there has to be a way of calculating the exact value.

My attempt at solving this was to take a definite integral of the standard normal curve function.

y = (1 / (sqrt(2 * PI))) * e^(-(1/2) * x^2)

This gives me the area under the curve between two x values but then I am stuck… Maybe I am way of base and this is not how you would do it?

Thanks.

解决方案

Here's some code for the normal distribution written in Python, but it could easily be translated to C# by adding some punctuation. It's just about 15 lines of code.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值