Browse Source

Distributions: Normal.CDF to use same Erfc implementation as the instance method, avoiding a problematic subtraction (accuracy) #348

pull/362/head
Christoph Ruegg 11 years ago
parent
commit
4369ee09cf
  1. 4
      src/Numerics/Distributions/Normal.cs

4
src/Numerics/Distributions/Normal.cs

@ -4,7 +4,7 @@
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // http://mathnetnumerics.codeplex.com
// //
// Copyright (c) 2009-2013 Math.NET // Copyright (c) 2009-2015 Math.NET
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
@ -496,7 +496,7 @@ namespace MathNet.Numerics.Distributions
throw new ArgumentException(Resources.InvalidDistributionParameters); throw new ArgumentException(Resources.InvalidDistributionParameters);
} }
return 0.5*(1.0 + SpecialFunctions.Erf((x - mean)/(stddev*Constants.Sqrt2))); return 0.5*SpecialFunctions.Erfc((mean - x)/(stddev*Constants.Sqrt2));
} }
/// <summary> /// <summary>

Loading…
Cancel
Save