Package jmathexpr

Examples of jmathexpr.Variable


    }

    @Test
    public void linear() throws EquationSolveException {
        Equation abs = (Equation) new ExpressionParser().parse("|2x - 1| = 5");
        Variable x = abs.variable();
        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here


    }

    @Test(dependsOnMethods = { "linear" })
    public void toIsolate() throws EquationSolveException {
        Equation abs = (Equation) new ExpressionParser().parse("|5x - 6| + 3 = 10");
        Variable x = abs.variable();
        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    }

    @Test(dependsOnMethods = { "toIsolate" })
    public void twoAbsExpressions() throws EquationSolveException {
        Equation abs = (Equation) new ExpressionParser().parse("|2x - 1| = |4x + 3|");
        Variable x = abs.variable();
        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    @Test(dependsOnMethods = { "twoAbsExpressions" })
    public void quadratic() throws EquationSolveException {
        ExpressionParser parser = new ExpressionParser();
        Equation abs = (Equation) parser.parse("|x^2 - 6x + 1| = |(3x + 5)/2|");
        Variable x = abs.variable();
        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    @Test(dependsOnMethods = { "quadratic" })
    public void anotherQuadratic() throws EquationSolveException {
        ExpressionParser parser = new ExpressionParser();
        Equation abs = (Equation) parser.parse("|x| = x^2 + x - 3");
        Variable x = abs.variable();
        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    }

    @Test
    public void simple() throws EquationSolveException {
        Equation lineq = (Equation) new ExpressionParser().parse("4*x + 3 = x + 27");
        Variable x = lineq.variable();
        System.out.printf("%s : %s = ?%n", lineq, x);
       
        Set    roots = lineq.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    }

    @Test(dependsOnMethods = { "simple" })
    public void parenthesis() throws EquationSolveException {
        Equation lineq = (Equation) new ExpressionParser().parse("2*(3*x - 7) + 4*(3*x + 2) = 6*(5*x + 9 ) + 3");
        Variable x = lineq.variable();
        System.out.printf("%s : %s = ?%n", lineq, x);
       
        Set    roots = lineq.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    @Test(dependsOnMethods = { "parenthesis" })
    public void rationals() throws EquationSolveException {
//        Equation lineq = (Equation) new ExpressionParser().parse("3/4 x + 5/6 = 5x - 125/3");
        Equation lineq = (Equation) new ExpressionParser().parse("3/4*x + 5/6 = 5x - 125/3");
        Variable x = lineq.variable();
        System.out.printf("%s : %s = ?%n", lineq, x);
       
        Set    roots = lineq.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    }

    @Test(dependsOnMethods = { "rationals" })
    public void fractions() throws EquationSolveException {
        Equation lineq = (Equation) new ExpressionParser().parse("(6x - 7)/4 + (3x - 5)/7 = (5x + 78)/28");
        Variable x = lineq.variable();
        System.out.printf("%s : %s = ?%n", lineq, x);
       
        Set    roots = lineq.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here

    }

    @Test(dependsOnMethods = { "fractions" })
    public void irrationalConstants() throws EquationSolveException {
        Equation lineq = (Equation) new ExpressionParser().parse("sqrt(2) x - sqrt(3) = sqrt(5)");
        Variable x = lineq.variable();
        System.out.printf("%s : %s = ?%n", lineq, x);
       
        Set roots = lineq.solve();
        System.out.printf("  %s = %s%n", x, roots);
View Full Code Here

TOP

Related Classes of jmathexpr.Variable

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.