forked from yuemingl/SymJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymComplex.java
More file actions
65 lines (53 loc) · 1.17 KB
/
Copy pathSymComplex.java
File metadata and controls
65 lines (53 loc) · 1.17 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package symjava.symbolic;
import symjava.symbolic.utils.Utils;
/**
* TODO
*
*/
public class SymComplex extends Expr {
Expr real;
Expr imaginary;
public SymComplex(Expr re, Expr im) {
real = re;
imaginary = im;
}
@Override
public Expr diff(Expr expr) {
return new SymComplex(real.diff(expr), imaginary.diff(expr));
}
public String toString() {
return real.label + "+" + imaginary.label + "i";
}
@Override
public Expr subs(Expr from, Expr to) {
if(Utils.symCompare(this, from))
return to;
return new SymComplex(real.subs(from, to), imaginary.subs(from, to));
}
@Override
public Expr simplify() {
return new SymComplex(real.simplify(), imaginary.simplify());
}
@Override
public boolean symEquals(Expr other) {
if(other instanceof SymComplex) {
SymComplex o = (SymComplex)other;
if(real.symEquals(o.real) && imaginary.symEquals(o.imaginary))
return true;
}
return false;
}
@Override
public TypeInfo getTypeInfo() {
// TODO Auto-generated method stub
return null;
}
@Override
public Expr[] args() {
return new Expr[] {real, imaginary};
}
@Override
public void updateLabel() {
// TODO Auto-generated method stub
}
}