private static ISpectralOdeOperator <double[][]> CreateOperator(int quadratureNodesCount) { // Used to calculate coeffs that are represented as integrals var quadratureNodes = new Segment(0, 1).GetUniformPartition(quadratureNodesCount); var cosSystem = new CosSystem(); var sobCosSystem = new SobolevCosSystem(); var op = new CosSpectralOdeOperator(Natural.NumbersWithZero.Select(k => cosSystem.Get(k)), Natural.NumbersWithZero.Select(k => sobCosSystem.Get(k)), quadratureNodes); return(op); }
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); }