Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
109 lines (87 loc) · 1.9 KB

File metadata and controls

109 lines (87 loc) · 1.9 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package symjava.symbolic;
import symjava.symbolic.utils.Utils;
public class SymReal<T extends Number> extends Expr {
protected T value;
public SymReal(T val) {
this.value = val;
label = String.valueOf(val);
sortKey = label;
isSimplified = true;
}
public T getValue() {
return value;
}
public double getDoubleValue() {
return value.doubleValue();
}
public int getIntValue() {
return value.intValue();
}
public long getLongValue() {
return value.longValue();
}
public float getFloatValue() {
return value.floatValue();
}
public boolean isInteger() {
double dval = value.doubleValue();
double remain = dval - Math.floor(dval);
if(remain == 0.0) {
return true;
}
return false;
}
public boolean isPositive () {
return value.doubleValue() > 0.0;
}
public boolean isNonPositive () {
return value.doubleValue() <= 0.0;
}
public boolean isNegative () {
return value.doubleValue() < 0.0;
}
public boolean isNonNegative () {
return value.doubleValue() >= 0.0;
}
public boolean isZero () {
return value.doubleValue() == 0.0;
}
public boolean isOne () {
return value.doubleValue() == 1.0;
}
public boolean isNegativeOne () {
return value.doubleValue() == -1.0;
}
public static <T extends Number> SymReal<T> valueOf(T val) {
return new SymReal<T>(val);
}
@Override
public Expr diff(Expr expr) {
return Symbol.C0;
}
@Override
public Expr subs(Expr from, Expr to) {
if(Utils.symCompare(this, from))
return to;
return this;
}
@Override
public Expr simplify() {
return this;
}
@Override
public boolean symEquals(Expr other) {
if(this == other)
return true;
else if(other instanceof SymReal<?>) {
SymReal<?> o = (SymReal<?>)other;
Number t1 = (Number)value;
Number t2 = (Number)o.getValue();
//if(t1.equals(t2))
// return true;
if(t1.doubleValue() == t2.doubleValue())
return true;
}
return false;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.