Package jmathexpr

Examples of jmathexpr.Expression


   
    @Test
    public void testPolynomials() {
        ExpressionParser parser = new ExpressionParser();
       
        Expression expression = parser.parse("let x in R");
       
        Logger.dump(expression);
    }
View Full Code Here


        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression expected = new FiniteSet(Naturals.getInstance().create(3), Integers.getInstance().create(-2));
        assertEquals(expected, roots);
    }
View Full Code Here

        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression expected = new FiniteSet(Rationals.getInstance().create(13, 5), Rationals.getInstance().create(-1, 5));
        assertEquals(expected, roots);
    }
View Full Code Here

        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression expected = new FiniteSet(Integers.getInstance().create(-2), Rationals.getInstance().create(-1, 3));
        assertEquals(expected, roots);
    }
View Full Code Here

        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression x1 = parser.parse("(15 + sqrt(249)) / 4");
        Expression x2 = parser.parse("(15 - sqrt(249)) / 4");
        Expression expected = new FiniteSet(x1, x2, Rationals.getInstance().create(7, 2), Naturals.one());
        assertEquals(expected, roots);
    }
View Full Code Here

        System.out.printf("%s : %s = ?%n", abs, x);
       
        Set roots = abs.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression x1 = parser.parse("sqrt(3)");
        Expression x2 = Integers.getInstance().create("-3");
        Expression expected = new FiniteSet(x1, x2);
        assertEquals(expected, roots);
    }
View Full Code Here

//        for (Equality e : lineq.getSteps()) {
//            System.out.printf("    %s%n", e);
//        }
       
        Expression expected = new ExpressionParser().parse("(sqrt(5) + sqrt(3)) / sqrt(2)");
       
        assertEquals(roots, new FiniteSet(expected));
    }
View Full Code Here

        System.out.printf("%s : %s = ?%n", quad, x);

        Set roots = quad.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression x1 = parser.parse("(5 + sqrt(13)) / 2");
        Expression x2 = parser.parse("(5 - sqrt(13)) / 2");
        Expression expected = new FiniteSet(x1, x2);
        assertEquals(expected, roots);
    }
View Full Code Here

        System.out.printf("%s : %s = ?%n", quad, x);
       
        Set roots = quad.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression expected = new EmptySet();
        assertEquals(expected, roots);
    }
View Full Code Here

        System.out.printf("%s : %s = ?%n", quad, x);

        Set roots = quad.solve();
        System.out.printf("  %s = %s%n", x, roots);
       
        Expression expected = new FiniteSet(Naturals.one(), Rationals.getInstance().create(-1, 2));
        assertEquals(expected, roots);
    }
View Full Code Here

TOP

Related Classes of jmathexpr.Expression

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.