本文整理汇总了C#中ScalarValue.Ln方法的典型用法代码示例。如果您正苦于以下问题:C# ScalarValue.Ln方法的具体用法?C# ScalarValue.Ln怎么用?C# ScalarValue.Ln使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScalarValue
的用法示例。
在下文中一共展示了ScalarValue.Ln方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SeriesLarge
// series useful for large x
static ScalarValue SeriesLarge(ScalarValue x)
{
var L1 = x.Ln();
var L2 = L1.Ln();
var L2L1 = L2 / L1;
return L1 - L2 + L2L1 + (L2 - 2.0) * L2L1 / L1 / 2.0;
}
示例2: GetValue
protected override ScalarValue GetValue(ScalarValue value)
{
return value.Ln();
}
示例3: LogGamma_Stirling
static ScalarValue LogGamma_Stirling(ScalarValue z)
{
if (z.Im < 0.0)
{
return LogGamma_Stirling(z.Conjugate()).Conjugate();
}
var f = (z - 0.5) * z.Ln() - z + Math.Log(2.0 * Math.PI) / 2.0;
var reduce = f.Im / (2.0 * Math.PI);
reduce = f.Im - (int)(reduce) * 2.0 * Math.PI;
f = new ScalarValue(f.Re, reduce);
var zsqu = z * z;
var zp = z.Clone();
for (var i = 1; i < 10; i++)
{
var f_old = f.Clone();
f += Helpers.BernoulliNumbers[i] / (2 * i) / (2 * i - 1) / zp;
if (f == f_old)
{
return (f);
}
zp = zp * zsqu;
}
throw new YAMPNotConvergedException("gamma");
}
示例4: LanczosLogGamma
static ScalarValue LanczosLogGamma(ScalarValue z)
{
ScalarValue sum = new ScalarValue(Helpers.LanczosD[0], 0.0);
for (int i = 1; i < Helpers.LanczosD.Length; i++)
sum += Helpers.LanczosD[i] / (z + i);
sum = (2.0 / Math.Sqrt(Math.PI)) * (sum / z);
var zshift = z + 0.5;
var t = zshift * (zshift + Helpers.LanczosR).Ln() - z;
return t + sum.Ln();
}
示例5: DiLog1
static ScalarValue DiLog1(ScalarValue e)
{
var f = new ScalarValue(Math.PI * Math.PI / 6.0);
if (e == 0.0)
{
return f;
}
var L = e.Ln();
var ek = ScalarValue.One;
for (var k = 1; k < 250; k++)
{
var f_old = f.Clone();
ek *= e;
var df = ek * (L - 1.0 / k) / k;
f += df;
if (f == f_old)
{
return f;
}
}
throw new YAMPNotConvergedException("spence");
}
示例6: DiLog_Log_Series
static ScalarValue DiLog_Log_Series(ScalarValue z)
{
var ln = z.Ln();
var ln2 = ln * ln;
var f = Math.PI * Math.PI / 6.0 + ln * (1.0 - (-ln).Ln()) - ln2 / 4.0;
var p = ln.Clone();
for (var k = 1; k < 17; k++)
{
var f_old = f.Clone();
p *= ln2 / (2 * k + 1) / (2 * k);
f += (-Helpers.BernoulliNumbers[k] / (2 * k)) * p;
if (f == f_old)
{
return f;
}
}
throw new YAMPNotConvergedException("spence");
}