public void ComplexReimannZetaPrimesTest() { // pick high enough values so that p^-x == 1 within double precision before we reach the end of our list of primes foreach (Complex z in TestUtilities.GenerateComplexValues(1.0, 100.0, 8)) { Complex zz = z; if (zz.Re < 0.0) { zz = -zz; } zz += 10.0; Console.WriteLine(zz); Complex f = 1.0; for (int p = 2; p < 100; p++) { if (!AdvancedIntegerMath.IsPrime(p)) { continue; } Complex t = Complex.One - ComplexMath.Pow(p, -zz); if (t == Complex.One) { break; } f = f * t; } Assert.IsTrue(TestUtilities.IsNearlyEqual(1.0 / AdvancedComplexMath.RiemannZeta(zz), f)); } }
public void ComplexRealRiemannZetaAgreement() { foreach (double x in TestUtilities.GenerateRealValues(1.0E-2, 1.0E2, 8)) { Assert.IsTrue(TestUtilities.IsNearlyEqual(AdvancedComplexMath.RiemannZeta(x), AdvancedMath.RiemannZeta(x))); Assert.IsTrue(TestUtilities.IsNearlyEqual(AdvancedComplexMath.RiemannZeta(-x), AdvancedMath.RiemannZeta(-x))); } }
public static void ComputeSpecialFunctions() { // Compute the value x at which erf(x) is just 10^{-15} from 1. double x = AdvancedMath.InverseErfc(1.0E-15); // The Gamma function at 1/2 is sqrt(pi) double y = AdvancedMath.Gamma(0.5); // Compute a Coulomb Wave Function in the quantum tunneling region SolutionPair s = AdvancedMath.Coulomb(2, 4.5, 3.0); // Compute the Reimann Zeta function at a complex value Complex z = AdvancedComplexMath.RiemannZeta(new Complex(0.75, 6.0)); // Compute the 100th central binomial coefficient double c = AdvancedIntegerMath.BinomialCoefficient(100, 50); }
public void ComplexRiemannZetaZeros() { // Zeros from http://www.dtc.umn.edu/~odlyzko/zeta_tables/zeros2 double[] zeros = new double[] { 14.134725141734693790, 21.022039638771554993, 25.010857580145688763, 30.424876125859513210 }; foreach (double zero in zeros) { double rho = FunctionMath.FindZero((double x) => { Complex f = AdvancedComplexMath.RiemannZeta(new Complex(0.5, x)); return(f.Re + f.Im); }, Math.Round(zero)); Assert.IsTrue(TestUtilities.IsNearlyEqual(rho, zero)); } }
private void Render() { DeviceContext renderTarget = _deviceContext; renderTarget.BeginDraw(); renderTarget.Clear(Color.FromKnown(Colors.Black, 1f)); for (double re = 0.5; re <= 2; re += 0.1d) { for (double im = -2; im <= 2; im += 0.1d) { Complex s = new Complex(re, im); Complex z = AdvancedComplexMath.RiemannZeta(s); PointF rs = TranslateToScreen(s.Real, s.Imaginary); PointF rz = TranslateToScreen(z.Real, z.Imaginary); renderTarget.DrawLine(_brush1, 1, rs, rz); } } renderTarget.EndDraw(); _swapChain.Present(1, 0); }
public static void Main(string[] args) { // calculate the factorials of 0 through 10 for (long counter = 0; counter <= 10; ++counter) { Console.WriteLine("{0}! = {1}", counter, Factorial(counter)); } // Compute the value x at which erf(x) is just 10^{-15} from 1. double x = AdvancedMath.InverseErfc(1.0E-15); Console.WriteLine("\n{0}", x); // The Gamma function at 1/2 is sqrt(pi) double y = AdvancedMath.Gamma(0.5); Console.WriteLine("\nThe Gamma function at 1/2 is sqrt(pi) = {0}", y); // Compute a Coulomb Wave Function in the quantum tunneling region SolutionPair s = AdvancedMath.Coulomb(2, 4.5, 3.0); Console.WriteLine("\nCompute a Coulomb Wave Function in the quantum tunneling region = {0}", s); // Compute the Reimann Zeta function at a complex value Complex z = AdvancedComplexMath.RiemannZeta(new Complex(0.75, 6.0)); Console.WriteLine("\nCompute the Reimann Zeta function at a complex value = {0}", z); // Compute the 100th central binomial coefficient double c = AdvancedIntegerMath.BinomialCoefficient(5, 2); Console.WriteLine("\n{0}", c); Console.WriteLine("\nTecle qualquer tecla para finalizar..."); Console.ReadKey(); } // end Main