Exemple #1
0
        /// <summary>
        /// Calculates $c_k(f_j)$
        /// </summary>
        /// <param name="i"></param>
        /// <param name="k"></param>
        /// <param name="fArgs"></param>
        /// <returns></returns>
        private double CalcCoeff(int i, int k, double[][] fArgs)
        {
            // qk[j] = $f_k(h t_j, \eta_0(t_j), ..., \eta_{m-1}(t_j)) * phi_k(t_j)$,
            // so qk is a vector of values of function $q_k(t)=f_k(ht,\eta_0(t),...) phi(t)$ in _nodes
            var qk = _nodes.Select((t, j) => _f[i].Invoke(fArgs[j]) * _phiCached[k](t));

            return(Integrals.Trapezoid(qk.ToArray(), _nodes));
        }
Exemple #2
0
 public void TrapezoidDiscreteTest()
 {
     RunTestCases(
         testCase =>
     {
         var nodes = GenerateNodes(testCase.A, testCase.B, testCase.NodesCount);
         var fD    = nodes.Select(t => testCase.Func(t)).ToArray();
         return(Integrals.Trapezoid(fD, nodes));
     });
 }
        public void CosSytemOrthonormality()
        {
            var cosSystem = new CosSystem();

            for (int i = 0; i < 100; i++)
            {
                var i1 = i;
                var v  = Integrals.Trapezoid(x => cosSystem.Get(i1)(x) * cosSystem.Get(i1)(x), 0, 1, 10000);
                Assert.AreEqual(1, v, 0.0000001);
            }

            var val = Integrals.Trapezoid(x => cosSystem.Get(0)(x) * cosSystem.Get(5)(x), 0, 1, 10000);

            Assert.AreEqual(0, val, 0.0000001);

            val = Integrals.Trapezoid(x => cosSystem.Get(4)(x) * cosSystem.Get(5)(x), 0, 1, 10000);
            Assert.AreEqual(0, val, 0.0000001);
        }
Exemple #4
0
 public void TrapezoidTest()
 {
     RunTestCases(
         testCase => Integrals.Trapezoid(testCase.Func, GenerateNodes(testCase.A, testCase.B, testCase.NodesCount))
         );
 }
Exemple #5
0
 public void TrapezoidEquiDistantNetTest()
 {
     RunTestCases(
         testCase => Integrals.Trapezoid(testCase.Func, testCase.A, testCase.B, testCase.NodesCount)
         );
 }
        private double coeffByDef(int n)
        {
            var w = Walsh.Get(n - 1);

            return(Integrals.Trapezoid(x => df(x) * w(x), 0, 1, 10000));
        }