-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.java
47 lines (41 loc) · 1.43 KB
/
Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
public class Test {
public static void main(String[] args) {
/*Single_Variable_Deriver test = new Single_Variable_Deriver("f(x) = (x+x*13)-(27x-x^2)");
System.out.println(test.Parse());
test = new Single_Variable_Deriver("f(x) = ((27)/(x-1)*(ln(x^2)))");
System.out.println(test.Parse());
System.out.print(test.variable);*/
Term term1 = new Term("2x^3", "x");
Term term2 = new Term("3x^2", "x");
Term term3 = new Term("4x^3", "x");
Term term4 = new Term("4x^2", "x");
//Expression exp1 = new Expression(term1, "+", term2);
Expression exp = new Expression(term1, "*", term2);
Expression exp1 = new Expression(term3, "*", term4);
Expression test = new Expression(exp, "*", exp1);
Expression test1;
//Expression test2;
test = test.simplify();
System.out.println(test);
test1 = test.derive();
System.out.println(test1 + "\n");
//test2 = test1.derive();
//System.out.println(test2 + "\n");
exp = new Expression(term2, "-", term3);
test = new Expression(exp, "+", term1);
test = test.simplify();
System.out.println(test);
test1 = test.derive();
System.out.println(test1 + "\n");
//test2 = test1.derive();
//System.out.println(test2 + "\n");
exp = new Expression(term2, "/", term3);
test = new Expression(exp, "/", term1);
test = test.simplify();
System.out.println(test);
test1 = test.derive();
System.out.println(test1);
//test2 = test1.derive();
//System.out.println(test2);
}
}