Esempio n. 1
0
        public void IntegrateOverRealPlane()
        {
            Func <double, double, double> integrand = (x, y) => Math.Exp(-x * x - y * y) / Math.PI;
            double result = ImproperQuadrature.IntegrateOverRealPlane(integrand, 1, 32);

            AssertHelper.AssertApproximatelyEqual(1, result, 4);
        }
Esempio n. 2
0
        public void IntegrateOverRealAxis()
        {
            Func <double, double> integrand = x => Functions.GaussianDistributionNormalized1D(x, 1);

            double result = ImproperQuadrature.IntegrateOverRealAxis(integrand, 2.7, 64);

            AssertHelper.AssertApproximatelyEqual(1, result);
        }
        public void UsingAveragedTemperature_SimpleInterpolationWithAverageDopplerShiftedTemperature()
        {
            CreateQQDataProvider(DopplerShiftEvaluationType.AveragedTemperature);

            // averaged temperature: T * sqrt(1-v*v) * artanh(v)/v
            // v = 0.874348...  =>  sqrt(1-v*v) * artanh(v)/v = 0.75
            AssertHelper.AssertApproximatelyEqual(450, Provider.GetInMediumDecayWidth(BottomiumState.Y1S, 400, 0.874348, 0, 0), 6);
        }
Esempio n. 4
0
        /********************************************************************************************
        * Private/protected static members, functions and properties
        ********************************************************************************************/

        private static void AssertSolutionsAreEqual(
            double[,] analyticalSolution,
            double[,] numericalSolution
            )
        {
            AssertEquallySizedFields(analyticalSolution, numericalSolution);

            AssertHelper.AssertApproximatelyEqual(0, GetMaxDeviation(analyticalSolution, numericalSolution));
        }
Esempio n. 5
0
        public void CalculateAverageMagneticFieldStrength()
        {
            FireballParam param = CreateFireballParamForAverageFieldStrengths();
            CollisionalElectromagneticField emf = new CollisionalElectromagneticField(param);

            double result = emf.CalculateAverageMagneticFieldStrength(0.4, QGPConductivity);

            AssertHelper.AssertApproximatelyEqual(0.16239, result, 5);
        }
Esempio n. 6
0
        public void OnDataPoints_InterpolationExact()
        {
            LinearInterpolation1D interpolation = new LinearInterpolation1D(
                new double[] { -3.1, 0.5, 4, 7.3 },
                new double[] { 23.3, -234.5, 45.4, -0.497 });

            AssertHelper.AssertApproximatelyEqual(23.3, interpolation.GetValue(-3.1));
            AssertHelper.AssertApproximatelyEqual(-234.5, interpolation.GetValue(0.5));
            AssertHelper.AssertApproximatelyEqual(45.4, interpolation.GetValue(4));
            AssertHelper.AssertApproximatelyEqual(-0.497, interpolation.GetValue(7.3));
        }
Esempio n. 7
0
 private static void AssertCorrectInitialQQPopulations(
     BottomiumVector initialQQPopulations
     )
 {
     AssertHelper.AssertApproximatelyEqual(13.831681883072372, initialQQPopulations[BottomiumState.Y1S]);
     AssertHelper.AssertApproximatelyEqual(43.694709398023143, initialQQPopulations[BottomiumState.x1P]);
     AssertHelper.AssertApproximatelyEqual(17.730737923019692, initialQQPopulations[BottomiumState.Y2S]);
     AssertHelper.AssertApproximatelyEqual(45.626563577477185, initialQQPopulations[BottomiumState.x2P]);
     AssertHelper.AssertApproximatelyEqual(10.893164282464252, initialQQPopulations[BottomiumState.Y3S]);
     AssertHelper.AssertApproximatelyEqual(7.6588791939455159E+99, initialQQPopulations[BottomiumState.x3P]);
 }
Esempio n. 8
0
 private static void AssertCorrectY1SFeedDownFractions(
     BottomiumVector feedDownFractions
     )
 {
     AssertHelper.AssertApproximatelyEqual(0.34302571070019483, feedDownFractions[BottomiumState.Y1S]);
     AssertHelper.AssertApproximatelyEqual(0.271, feedDownFractions[BottomiumState.x1P]);
     AssertHelper.AssertApproximatelyEqual(0.19033036269430051, feedDownFractions[BottomiumState.Y2S]);
     AssertHelper.AssertApproximatelyEqual(0.105, feedDownFractions[BottomiumState.x2P]);
     AssertHelper.AssertApproximatelyEqual(0.030643926605504589, feedDownFractions[BottomiumState.Y3S]);
     AssertHelper.AssertApproximatelyEqual(0.06, feedDownFractions[BottomiumState.x3P]);
 }
Esempio n. 9
0
        private static void AssertCorrectProtonProtonDimuonDecays(
            BottomiumVector ppDimuonDecays
            )
        {
            BottomiumVector expected = BottomiumCascade.GetNormalizedProtonProtonDimuonDecays();

            foreach (BottomiumState state in Enum.GetValues(typeof(BottomiumState)))
            {
                AssertHelper.AssertApproximatelyEqual(expected[state], ppDimuonDecays[state]);
            }
        }
Esempio n. 10
0
        public void IntegrateOverPositiveAxis()
        {
            double diffuseness              = 1;
            double nuclearRadius            = 5;
            Func <double, double> integrand = r => 4 * Math.PI * r * r
                                              * Functions.WoodsSaxonPotentialNormalized3D(r, nuclearRadius, diffuseness);

            double result = ImproperQuadrature.IntegrateOverPositiveAxis(integrand, 2 * nuclearRadius, 64);

            AssertHelper.AssertApproximatelyEqual(1, result);
        }
Esempio n. 11
0
 private static void AssertIsUnitMatrix(
     BottomiumCascadeMatrix multipliedMatrix
     )
 {
     foreach (BottomiumState i in Enum.GetValues(typeof(BottomiumState)))
     {
         foreach (BottomiumState j in Enum.GetValues(typeof(BottomiumState)))
         {
             AssertHelper.AssertApproximatelyEqual(
                 UnitMatrixEntries(i, j), multipliedMatrix[i, j]);
         }
     }
 }
Esempio n. 12
0
        private static void AssertCorrectMeanParticipantsInBin_pPb(BinBoundaryCalculator calculator)
        {
            List <double> nparts = calculator.MeanParticipantsInBin[0];

            Assert.AreEqual(7, nparts.Count);
            AssertHelper.AssertApproximatelyEqual(15.257, nparts[0], 5);
            AssertHelper.AssertApproximatelyEqual(14.760, nparts[1], 5);
            AssertHelper.AssertApproximatelyEqual(13.742, nparts[2], 5);
            AssertHelper.AssertApproximatelyEqual(12.231, nparts[3], 5);
            AssertHelper.AssertApproximatelyEqual(10.703, nparts[4], 5);
            AssertHelper.AssertApproximatelyEqual(9.0377, nparts[5], 5);
            AssertHelper.AssertApproximatelyEqual(3.5060, nparts[6], 5);
        }
Esempio n. 13
0
        private static void AssertCorrectMeanParticipantsInBin_PbPb(BinBoundaryCalculator calculator)
        {
            List <double> nparts = calculator.MeanParticipantsInBin[0];

            Assert.AreEqual(7, nparts.Count);
            AssertHelper.AssertApproximatelyEqual(383.37, nparts[0], 5);
            AssertHelper.AssertApproximatelyEqual(339.85, nparts[1], 5);
            AssertHelper.AssertApproximatelyEqual(268.00, nparts[2], 5);
            AssertHelper.AssertApproximatelyEqual(186.95, nparts[3], 5);
            AssertHelper.AssertApproximatelyEqual(131.58, nparts[4], 5);
            AssertHelper.AssertApproximatelyEqual(88.942, nparts[5], 5);
            AssertHelper.AssertApproximatelyEqual(19.579, nparts[6], 5);
        }
Esempio n. 14
0
 private static void AssertCorrectFlatImpactParamsArray(
     List <double> flatImpactParams
     )
 {
     AssertHelper.AssertApproximatelyEqual(0, flatImpactParams[0]);
     AssertHelper.AssertApproximatelyEqual(3.2, flatImpactParams[1]);
     AssertHelper.AssertApproximatelyEqual(4.4, flatImpactParams[2]);
     AssertHelper.AssertApproximatelyEqual(6.8, flatImpactParams[3]);
     AssertHelper.AssertApproximatelyEqual(8.4, flatImpactParams[4]);
     AssertHelper.AssertApproximatelyEqual(9.6, flatImpactParams[5]);
     AssertHelper.AssertApproximatelyEqual(10.8, flatImpactParams[6]);
     AssertHelper.AssertApproximatelyEqual(12, flatImpactParams[7]);
     AssertHelper.AssertApproximatelyEqual(21.2, flatImpactParams[8]);
 }
Esempio n. 15
0
        public void GivenSineValues_InterpolateLinear()
        {
            LinearInterpolation1D interpolation = new LinearInterpolation1D(
                new double[] { -4, -3, 0, 1, 5, 8, 9 },
                new double[] { Math.Sin(-4), Math.Sin(-3), Math.Sin(0), Math.Sin(1), Math.Sin(5), Math.Sin(8), Math.Sin(9) });

            AssertHelper.AssertApproximatelyEqual(Math.Sin(-4), interpolation.GetValue(-4));
            AssertHelper.AssertApproximatelyEqual(Math.Sin(-3) / 1.5, interpolation.GetValue(-2));
            AssertHelper.AssertApproximatelyEqual(Math.Sin(0), interpolation.GetValue(0));
            AssertHelper.AssertApproximatelyEqual((Math.Sin(5) + 3 * Math.Sin(1)) / 4.0, interpolation.GetValue(2));
            AssertHelper.AssertApproximatelyEqual((3 * Math.Sin(5) + Math.Sin(1)) / 4.0, interpolation.GetValue(4));
            AssertHelper.AssertApproximatelyEqual((Math.Sin(8) + 2 * Math.Sin(5)) / 3.0, interpolation.GetValue(6));
            AssertHelper.AssertApproximatelyEqual((Math.Sin(9) + Math.Sin(8)) / 2.0, interpolation.GetValue(8.5));
        }
Esempio n. 16
0
        private static void AssertCorrectImpactParamsAtBinBoundaries_pPb(BinBoundaryCalculator calculator)
        {
            List <double> impactParams = calculator.ImpactParamsAtBinBoundaries[0];

            Assert.AreEqual(8, impactParams.Count);
            AssertHelper.AssertApproximatelyEqual(0, impactParams[0]);
            AssertHelper.AssertApproximatelyEqual(1.6, impactParams[1]);
            AssertHelper.AssertApproximatelyEqual(2.4, impactParams[2]);
            AssertHelper.AssertApproximatelyEqual(3.6, impactParams[3]);
            AssertHelper.AssertApproximatelyEqual(4.4, impactParams[4]);
            AssertHelper.AssertApproximatelyEqual(5.0, impactParams[5]);
            AssertHelper.AssertApproximatelyEqual(5.6, impactParams[6]);
            AssertHelper.AssertApproximatelyEqual(14.0, impactParams[7]);
        }
Esempio n. 17
0
        public void GivenLinearInput_InterpolationExact()
        {
            LinearInterpolation1D interpolation = new LinearInterpolation1D(
                new double[] { -4, -3, 0, 1, 5 },
                new double[] { -6, -4, 2, 4, 12 });

            AssertHelper.AssertApproximatelyEqual(-6, interpolation.GetValue(-4));
            AssertHelper.AssertApproximatelyEqual(-4, interpolation.GetValue(-3));
            AssertHelper.AssertApproximatelyEqual(-2, interpolation.GetValue(-2));
            AssertHelper.AssertApproximatelyEqual(0, interpolation.GetValue(-1));
            AssertHelper.AssertApproximatelyEqual(2, interpolation.GetValue(0));
            AssertHelper.AssertApproximatelyEqual(4, interpolation.GetValue(1));
            AssertHelper.AssertApproximatelyEqual(6, interpolation.GetValue(2));
            AssertHelper.AssertApproximatelyEqual(8, interpolation.GetValue(3));
            AssertHelper.AssertApproximatelyEqual(10, interpolation.GetValue(4));
            AssertHelper.AssertApproximatelyEqual(12, interpolation.GetValue(5));
        }
Esempio n. 18
0
        private void AssertCorrectElectricFieldValues(SpatialVector[] fieldValues)
        {
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].X, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0.10682, fieldValues[1].X, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[1].Y, 5);
            AssertHelper.AssertApproximatelyEqual(-1.7582E-05, fieldValues[1].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0.10155, fieldValues[2].X, 5);
            AssertHelper.AssertApproximatelyEqual(0.29162, fieldValues[2].Y, 5);
            AssertHelper.AssertApproximatelyEqual(-7.9711E-06, fieldValues[2].Z, 5);

            AssertHelper.AssertApproximatelyEqual(-0.0056360, fieldValues[3].X, 5);
            AssertHelper.AssertApproximatelyEqual(0.0045088, fieldValues[3].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[3].Z, 5);
        }
Esempio n. 19
0
        private void AssertCorrectMagneticFieldValues(SpatialVector[] fieldValues)
        {
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].X, 5);
            AssertHelper.AssertApproximatelyEqual(0.54102, fieldValues[0].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0, fieldValues[1].X, 5);
            AssertHelper.AssertApproximatelyEqual(0.52301, fieldValues[1].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[1].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0.025290, fieldValues[2].X, 5);
            AssertHelper.AssertApproximatelyEqual(0.49767, fieldValues[2].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[2].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0.0045087, fieldValues[3].X, 5);
            AssertHelper.AssertApproximatelyEqual(0.0056358, fieldValues[3].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[3].Z, 5);
        }
        private void AssertCorrectElectricFieldValues(SpatialVector[] fieldValues)
        {
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].X, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[0].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0.088801, fieldValues[1].X, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[1].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[1].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0.084533, fieldValues[2].X, 5);
            AssertHelper.AssertApproximatelyEqual(0.16907, fieldValues[2].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[2].Z, 5);

            AssertHelper.AssertApproximatelyEqual(0, fieldValues[3].X, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[3].Y, 5);
            AssertHelper.AssertApproximatelyEqual(0, fieldValues[3].Z, 5);
        }
Esempio n. 21
0
        public void GivenLinear2DInput_InterpolationExact()
        {
            LinearInterpolation2D interpolation = new LinearInterpolation2D(
                new double[] { -4, -3, 0 },
                new double[] { -1, 2, 5 },
                new double[, ] {
                { -5, -2, 1 }, { -4, -1, 2 }, { -1, 2, 5 }
            });

            AssertHelper.AssertApproximatelyEqual(-0.5, interpolation.GetValue(-3.5, 3));
            AssertHelper.AssertApproximatelyEqual(0, interpolation.GetValue(-2, 2));
            AssertHelper.AssertApproximatelyEqual(2, interpolation.GetValue(-1, 3));
            AssertHelper.AssertApproximatelyEqual(0.3, interpolation.GetValue(-2.9, 3.2));
            AssertHelper.AssertApproximatelyEqual(-1.5, interpolation.GetValue(-4, 2.5));
            AssertHelper.AssertApproximatelyEqual(1, interpolation.GetValue(0, 1));
            AssertHelper.AssertApproximatelyEqual(0.6, interpolation.GetValue(-1, 1.6));
            AssertHelper.AssertApproximatelyEqual(-3.1, interpolation.GetValue(-3.2, 0.1));
            AssertHelper.AssertApproximatelyEqual(2.5, interpolation.GetValue(-2, 4.5));
        }
Esempio n. 22
0
        private void AssertCorrectPointChargeFields_URLimitFourierSynthesis(
            double[,] fieldValues
            )
        {
            AssertHelper.AssertApproximatelyEqual(0.0049465, fieldValues[0, 0], 5);
            AssertHelper.AssertApproximatelyEqual(0.0059384, fieldValues[0, 1], 5);
            AssertHelper.AssertApproximatelyEqual(0.0017557, fieldValues[0, 2], 5);
            AssertHelper.AssertApproximatelyEqual(0.00014831, fieldValues[0, 3], 5);
            AssertHelper.AssertApproximatelyEqual(2.5188E-05, fieldValues[0, 4], 5);

            AssertHelper.AssertApproximatelyEqual(1.1963E-05, fieldValues[1, 0], 5);
            AssertHelper.AssertApproximatelyEqual(7.5820E-08, fieldValues[1, 1], 5);
            AssertHelper.AssertApproximatelyEqual(-9.5155E-07, fieldValues[1, 2], 5);
            AssertHelper.AssertApproximatelyEqual(-1.2201E-07, fieldValues[1, 3], 5);
            AssertHelper.AssertApproximatelyEqual(-2.2137E-08, fieldValues[1, 4], 5);

            AssertHelper.AssertApproximatelyEqual(0.0049467, fieldValues[2, 0], 5);
            AssertHelper.AssertApproximatelyEqual(0.0059387, fieldValues[2, 1], 5);
            AssertHelper.AssertApproximatelyEqual(0.0017558, fieldValues[2, 2], 5);
            AssertHelper.AssertApproximatelyEqual(0.00014832, fieldValues[2, 3], 5);
            AssertHelper.AssertApproximatelyEqual(2.5189E-05, fieldValues[2, 4], 5);
        }
Esempio n. 23
0
        private void AssertCorrectPointChargeFields_DiffusionApproximation(
            double[,] fieldValues
            )
        {
            AssertHelper.AssertApproximatelyEqual(0.0046865, fieldValues[0, 0], 5);
            AssertHelper.AssertApproximatelyEqual(0.0059895, fieldValues[0, 1], 5);
            AssertHelper.AssertApproximatelyEqual(0.0017524, fieldValues[0, 2], 5);
            AssertHelper.AssertApproximatelyEqual(0.00014811, fieldValues[0, 3], 5);
            AssertHelper.AssertApproximatelyEqual(2.5172E-05, fieldValues[0, 4], 5);

            AssertHelper.AssertApproximatelyEqual(1.2986E-05, fieldValues[1, 0], 5);
            AssertHelper.AssertApproximatelyEqual(3.2767E-08, fieldValues[1, 1], 5);
            AssertHelper.AssertApproximatelyEqual(-9.5970E-07, fieldValues[1, 2], 5);
            AssertHelper.AssertApproximatelyEqual(-1.2207E-07, fieldValues[1, 3], 5);
            AssertHelper.AssertApproximatelyEqual(-2.2139E-08, fieldValues[1, 4], 5);

            AssertHelper.AssertApproximatelyEqual(0.0046868, fieldValues[2, 0], 5);
            AssertHelper.AssertApproximatelyEqual(0.0059898, fieldValues[2, 1], 5);
            AssertHelper.AssertApproximatelyEqual(0.0017525, fieldValues[2, 2], 5);
            AssertHelper.AssertApproximatelyEqual(0.00014812, fieldValues[2, 3], 5);
            AssertHelper.AssertApproximatelyEqual(2.5174E-05, fieldValues[2, 4], 5);
        }
Esempio n. 24
0
        private void AssertCorrectPointChargeFields_FreeSpace(
            double[,] fieldValues
            )
        {
            AssertHelper.AssertApproximatelyEqual(0.0092479, fieldValues[0, 0], 5);
            AssertHelper.AssertApproximatelyEqual(0.00026408, fieldValues[0, 1], 5);
            AssertHelper.AssertApproximatelyEqual(1.7629E-05, fieldValues[0, 2], 5);
            AssertHelper.AssertApproximatelyEqual(2.7757E-07, fieldValues[0, 3], 5);
            AssertHelper.AssertApproximatelyEqual(1.7772E-08, fieldValues[0, 4], 5);

            AssertHelper.AssertApproximatelyEqual(-0.00012497, fieldValues[1, 0], 5);
            AssertHelper.AssertApproximatelyEqual(-1.4275E-05, fieldValues[1, 1], 5);
            AssertHelper.AssertApproximatelyEqual(-2.3823E-06, fieldValues[1, 2], 5);
            AssertHelper.AssertApproximatelyEqual(-1.5004E-07, fieldValues[1, 3], 5);
            AssertHelper.AssertApproximatelyEqual(-2.4016E-08, fieldValues[1, 4], 5);

            AssertHelper.AssertApproximatelyEqual(0.0092484, fieldValues[2, 0], 5);
            AssertHelper.AssertApproximatelyEqual(0.00026409, fieldValues[2, 1], 5);
            AssertHelper.AssertApproximatelyEqual(1.7630E-05, fieldValues[2, 2], 5);
            AssertHelper.AssertApproximatelyEqual(2.7758E-07, fieldValues[2, 3], 5);
            AssertHelper.AssertApproximatelyEqual(1.7773E-08, fieldValues[2, 4], 5);
        }
        public void UsingAveragedTemperature_AverageDecayWidthsEvaluatedAtDopplerShiftedTemperatures()
        {
            CreateQQDataProvider(DopplerShiftEvaluationType.AveragedDecayWidth);

            AssertHelper.AssertApproximatelyEqual(303.366, Provider.GetInMediumDecayWidth(BottomiumState.Y1S, 200, 0.2, 0, 0), 6);
        }