Package jmathexpr

Examples of jmathexpr.Variable


    }

    @Test(dependsOnMethods = { "oneRadical" })
    public void toIsolate() throws EquationSolveException {
        Equation req = (Equation) new ExpressionParser().parse("sqrt(x - 10) - 4 = 0");
        Variable x = req.variable();
        System.out.printf("%s : %s = ?%n", req, x);
       
        Set roots = req.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
View Full Code Here


    }

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

    }

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

    }

    @Test(dependsOnMethods = { "twoRadicals" })
    public void threeRadicals() throws EquationSolveException {
        Equation req = (Equation) new ExpressionParser().parse("sqrt(x + 8) + sqrt(x + 15) = sqrt(9x + 40)");
        Variable x = req.variable();
        System.out.printf("%s : %s = ?%n", req, x);
       
        Set roots = req.solve();
        System.out.printf("  %s = %s%n", x, roots);
View Full Code Here

     *
     * @param name the name of the variable
     * @return a new Variable instance
     */
    public static Variable variable(String name) {
        return new Variable(name, Reals.getInstance());
    }
View Full Code Here

    }
   
    private Map<Expression, List<Expression>> selectLikeTerms(List<Expression> evaluated) {
        Map<Expression, List<Expression>> selected = new HashMap(); // ai*f(x) -> a1, a2, ... an
        TerminationPattern c = new Constant();
        TerminationPattern f = new FunctionPattern(new Variable());
        ExpressionPattern p = new Multiplication(c, f);
       
        for (Expression e : evaluated) {
            if (e.isConstant()) {
                continue;
View Full Code Here

    }
   
    @Override
    public void exitLet(ExpressionsParser.LetContext ctx) {
        Set domain = (Set) stack.pop();
        Variable tmp = (Variable) stack.pop();
       
        Variable x = new Variable(tmp.name(), domain);
        Expression contains = new ElementOf(x, domain);
       
        statement = new Statement(Command.Let, contains);
       
        ExpressionContext.getInstance().addVariable(x);
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.