问题描述
我正在尝试将以下数学方程从表达式正态累积分布转换为 Unity 中的 C#。 norMSdisT 是 Excel 中使用的表达式,我认为通过它可以在 C# 中完成。那么这个等式有简化的方法吗?
解决方法
感谢您的评论。我使用 using MathNet.Numerics;
实现了这一点。您可以通过安装 NuGet - https://github.com/GlitchEnzo/NuGetForUnity 来下载此 Unity 包。
因此,以下工作:
using System;
using System.Collections;
using System.Collections.Generic;
using MathNet.Numerics;
using UnityEngine;
public class CumulativeFunction : MonoBehaviour {
void Start () {
F (-0.48f);
}
static double F (double x) {
MathNet.Numerics.Distributions.Normal result = new MathNet.Numerics.Distributions.Normal ();
return result.CumulativeDistribution (x);
}
}