예제 #1
0
    public void InvalidateData_Twice_CheckLowerBound()
    {
        //Create an ODE initial value problem
        ODEInitialValueProblem ivp    = new ODEInitialValueProblem(3, 0.2, 0);
        ExpressionParser       parser = new ExpressionParser();

        //Define a system in which the solution will be (3,4,5) at all times
        ivp.F.funcs[0] = parser.EvaluateExpression("0").ToDelegate("t");
        ivp.F.funcs[1] = parser.EvaluateExpression("0").ToDelegate("t");
        ivp.F.funcs[2] = parser.EvaluateExpression("0").ToDelegate("t");
        ivp.SetState(new VectorND(3, 4, 5), 0);
        //Solve the problem
        ivp.SolveTo(3);
        //Invalidate the data at t=1
        ivp.InvalidateData(1);
        //Now solve to 5
        ivp.SolveTo(5);
        //Invalidate data at t=0.5
        ivp.InvalidateData(0.5);
        //Check the upper bound
        Assert.AreEqual(ivp.GetDataUpperBound(), 0.5, general_purpose_required_accuracy);
    }
예제 #2
0
    public void InvalidateData_OutOfBoundsOfDataSet_CheckUpperBound()
    {
        //Create an ODE initial value problem
        ODEInitialValueProblem ivp    = new ODEInitialValueProblem(3, 0.2, 0);
        ExpressionParser       parser = new ExpressionParser();

        //Define a system in which the solution will be (3,4,5) at all times
        ivp.F.funcs[0] = parser.EvaluateExpression("0").ToDelegate("t");
        ivp.F.funcs[1] = parser.EvaluateExpression("0").ToDelegate("t");
        ivp.F.funcs[2] = parser.EvaluateExpression("0").ToDelegate("t");
        ivp.SetState(new VectorND(3, 4, 5), 0);
        //Solve the problem
        ivp.SolveTo(3);
        //Invalidate the data at t=2000
        ivp.InvalidateData(2000);
        //Check the valid data interval
        Assert.AreEqual(ivp.GetDataUpperBound(), 2000, general_purpose_required_accuracy);
    }