Package uk.ac.cranfield.thesis.shared.model

Examples of uk.ac.cranfield.thesis.shared.model.Equation


        String[] parts = input.split(",");
       
        if (parts.length < 2)
            throw new IncorrectODEEquationException("lack of initial values");
       
        Equation equation = new Equation(parts[0]);
        equation.setOrder(longestRun(parts[0], '\'', 1));
       
        List<String> init = new ArrayList<String>(parts.length - 1);
        for (int i = 1; i < parts.length; i++)
            init.add(parts[i]);
       
        equation.setInitValues(parseInitialValues(init));
        equation.setFunctionVariable(parseFunctionVariable(parts[0]));
        equation.setIndependentVariable(parseIndependentVariable(parts[0], equation.getFunctionVariable()));
       
        if (equation.getFunctionVariable() != parts[1].charAt(0))
            throw new IncorrectODEEquationException("Incorrect initial variable");
       
        return equation;
    }
View Full Code Here


        for (String input : inputs)
        {
            input = input.replace(" ", "").toLowerCase();
            String[] parts = input.split(",");
           
            Equation equation = new Equation(parts[0]);
            equation.setOrder(longestRun(parts[0], '\'', 1));
            if (equation.getOrder() < parts.length - 1)
                throw new IncorrectODEEquationException("lack of initial values");
           
            List<String> init = new ArrayList<String>(parts.length - 1);
            for (int i = 1; i < parts.length; i++)
                init.add(parts[i]);
           
            equation.setInitValues(parseInitialValues(init));
            equation.setFunctionVariable(parseFunctionVariable(parts[0]));
            functionalVariables.add(equation.getFunctionVariable());
           
            system.addEquation(equation);
        }
       
       
View Full Code Here

   
    public void test1OrderMathPowerEquation()
    {
        delayTestFinish(500);
       
        Equation equation = new Equation("y'=y+x^2");
        equation.setFunctionVariable('y');
        equation.setIndependentVariable('x');
        equation.setOrder(1);
       
        List<Double> list = new ArrayList<Double>();
        list.add(0.0);
       
        equation.setInitValues(list);
       
        solverService.solve(equation, 0.1, 0.0, 1.0, new AsyncCallback<Solution>()
        {
           
            @Override
View Full Code Here

   
    public void test1OrderMathSinCosEquation()
    {
        delayTestFinish(500);
       
        Equation equation = new Equation("y'=sin(x)+cos(x)");
        equation.setFunctionVariable('y');
        equation.setIndependentVariable('x');
        equation.setOrder(1);
       
        List<Double> list = new ArrayList<Double>();
        list.add(0.0);
       
        equation.setInitValues(list);
       
        solverService.solve(equation, 0.1, 0.0, 1.0, new AsyncCallback<Solution>()
        {
           
            @Override
View Full Code Here

   
    public void test1OrderEquation()
    {
        delayTestFinish(500);
       
        Equation equation = new Equation("y'=-2*y+x+4");
        equation.setFunctionVariable('y');
        equation.setIndependentVariable('x');
        equation.setOrder(1);
       
        List<Double> list = new ArrayList<Double>();
        list.add(1.0);
       
        equation.setInitValues(list);
       
        solverService.solve(equation, 0.01, 0.0, 0.2, new AsyncCallback<Solution>()
        {
           
            @Override
View Full Code Here

   
    public void test1OrderSystem()
    {
        delayTestFinish(500);
       
        Equation equation = new Equation("y'= y + x");
        equation.setIndependentVariable('x');
        equation.setFunctionVariable('y');
        equation.setOrder(1);
       
        Equation equation2 = new Equation("z'= z + y + x");
        equation2.setIndependentVariable('x');
        equation2.setFunctionVariable('z');
        equation2.setOrder(1);
       
        List<Double> list = new ArrayList<Double>();
        list.add(0.0);
       
        List<Double> list2 = new ArrayList<Double>();
        list2.add(0.0);
       
        equation.setInitValues(list);
        equation2.setInitValues(list2);
        List<Equation> equations = new ArrayList<Equation>(2);
        equations.add(equation);
        equations.add(equation2);
        System system = new System(equations);
       
View Full Code Here

       
        // TODO : transformthis test into parser test
       
        delayTestFinish(500);
       
        Equation equation = new Equation("y'= y + x");
        equation.setIndependentVariable('x');
        equation.setFunctionVariable('y');
        equation.setOrder(1);
       
        Equation equation2 = new Equation("z'= z+x+y");
        equation2.setIndependentVariable('x');
        equation2.setFunctionVariable('z');
        equation2.setOrder(1);
       
        List<Double> list = new ArrayList<Double>();
        list.add(0.0);
       
        List<Double> list2 = new ArrayList<Double>();
        list2.add(0.0);
       
        equation.setInitValues(list);
        equation2.setInitValues(list2);
        List<Equation> equations = new ArrayList<Equation>(2);
        equations.add(equation);
        equations.add(equation2);
        System system = new System(equations);
       
View Full Code Here

   
    public void test1OrderSystem3()
    {
        delayTestFinish(500);
       
        Equation equation = new Equation("y'= y + x");
        equation.setIndependentVariable('x');
        equation.setFunctionVariable('y');
        equation.setOrder(1);
       
        Equation equation2 = new Equation("z'= z + y + x");
        equation2.setIndependentVariable('x');
        equation2.setFunctionVariable('z');
        equation2.setOrder(1);
       
        Equation equation3 = new Equation("u'= u + x + 4");
        equation3.setIndependentVariable('x');
        equation3.setFunctionVariable('u');
        equation3.setOrder(1);
       
       
        List<Double> list = new ArrayList<Double>();
        list.add(0.0);
       
        List<Double> list2 = new ArrayList<Double>();
        list2.add(0.0);
       
        List<Double> list3 = new ArrayList<Double>();
        list3.add(0.0);
       
        equation.setInitValues(list);
        equation2.setInitValues(list2);
        equation3.setInitValues(list3);
       
        List<Equation> equations = new ArrayList<Equation>(3);
       
        equations.add(equation);
        equations.add(equation2);
View Full Code Here

TOP

Related Classes of uk.ac.cranfield.thesis.shared.model.Equation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.