Skip to content

Commit dafd4a7

Browse files
committed
Use EvalEngine#evalNumericFunction()
1 parent 4eeba2b commit dafd4a7

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/Arithmetic.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public IExpr evaluateArg1(final IExpr arg1, EvalEngine engine) {
314314
return ((INumber) arg1).abs();
315315
}
316316
if (arg1.isNumericFunction(true)) {
317-
IExpr temp = engine.evalN(arg1);
317+
IExpr temp = engine.evalNumericFunction(arg1);
318318
if (temp.isReal()) {
319319
return arg1.copySign((IReal) temp);
320320
}
@@ -6360,7 +6360,7 @@ public IExpr e2ObjArg(IAST ast, final IExpr arg1, final IExpr arg2) {
63606360

63616361
switch (arg2Ordinal) {
63626362
case ID.Plus:
6363-
if (arg1.isFraction() && arg1.isNegative() && arg2.isPlus()) {
6363+
if (arg1.isFraction() && arg2.isPlus() && arg1.isNegative()) {
63646364
return F.Times(arg1.negate(), arg2.negate());
63656365
}
63666366
break;
@@ -6375,7 +6375,7 @@ public IExpr e2ObjArg(IAST ast, final IExpr arg1, final IExpr arg2) {
63756375
}
63766376
break;
63776377
case ID.Log:
6378-
if (arg1.isNegative() && arg2.isLog() && arg2.first().isFraction() && arg1.isReal()) {
6378+
if (arg1.isReal() && arg2.isLog() && arg1.isNegative() && arg2.first().isFraction()) {
63796379
IFraction f = (IFraction) arg2.first();
63806380
if (f.isPositive() && f.isLT(F.C1)) {
63816381
// -<number> * Log(<fraction>) -> <number> * Log(<fraction>.inverse())

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/generic/BinaryNumerical.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ public BinaryNumerical(final IExpr fn, final ISymbol v1, final ISymbol v2,
4848
@Override
4949
public IExpr apply(final IExpr firstArg, final IExpr secondArg) {
5050
return fEngine
51-
.evalN(F.subst(fun, F.list(F.Rule(variable1, firstArg), F.Rule(variable2, secondArg))));
51+
.evalNumericFunction(F.subst(fun, F.list(F.Rule(variable1, firstArg), F.Rule(variable2, secondArg))));
5252
}
5353

54+
@Override
5455
public double value(final double x, final double y) {
5556
double result = 0.0;
5657
try {

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/generic/UnaryCompiled.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public IExpr apply(final IExpr value) {
113113
*/
114114
public IExpr applyLimit(IExpr value) {
115115
try {
116-
return fEngine.evalN(F.Limit(fUnaryFunction, F.Rule(fVariable, value)));
116+
return fEngine.evalNumericFunction(F.Limit(fUnaryFunction, F.Rule(fVariable, value)));
117117
} catch (RuntimeException rex) {
118118
return S.Indeterminate;
119119
}
@@ -128,7 +128,7 @@ public IExpr applyLimit(IExpr value) {
128128
@Override
129129
public IExpr apply(double value) {
130130
try {
131-
return fEngine.evalN(F.subst(fUnaryFunction, F.Rule(fVariable, F.num(value))));
131+
return fEngine.evalNumericFunction(F.subst(fUnaryFunction, F.Rule(fVariable, F.num(value))));
132132
} catch (RuntimeException rex) {
133133
return S.Indeterminate;
134134
}

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/generic/UnaryNumerical.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public UnaryNumerical(final IExpr unaryFunction, final ISymbol variable, final E
9090

9191
@Override
9292
public IExpr apply(final IExpr value) {
93-
return fEngine.evalN(F.subst(fUnaryFunction, F.Rule(fVariable, value)));
93+
return fEngine.evalNumericFunction(F.subst(fUnaryFunction, F.Rule(fVariable, value)));
9494
}
9595

9696
/**
@@ -102,7 +102,7 @@ public IExpr apply(final IExpr value) {
102102
*/
103103
public IExpr applyLimit(IExpr value) {
104104
try {
105-
return fEngine.evalN(F.Limit(fUnaryFunction, F.Rule(fVariable, value)));
105+
return fEngine.evalNumericFunction(F.Limit(fUnaryFunction, F.Rule(fVariable, value)));
106106
} catch (RuntimeException rex) {
107107
return S.Indeterminate;
108108
}
@@ -117,7 +117,7 @@ public IExpr applyLimit(IExpr value) {
117117
@Override
118118
public IExpr apply(double value) {
119119
try {
120-
return fEngine.evalN(F.subst(fUnaryFunction, F.Rule(fVariable, F.num(value))));
120+
return fEngine.evalNumericFunction(F.subst(fUnaryFunction, F.Rule(fVariable, F.num(value))));
121121
} catch (RuntimeException rex) {
122122
return S.Indeterminate;
123123
}

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/graphics/Show3D2ThreeJS.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class Show3D2ThreeJS {
4040
@Deprecated
4141
private static void graphics3dToSVG(IAST ast, StringBuilder buf) {
4242
EvalEngine engine = EvalEngine.get();
43-
IAST numericAST = (IAST) engine.evalN(ast);
43+
IAST numericAST = (IAST) engine.evalNumericFunction(ast);
4444
double[] viewpoints = new double[] {1.3, -2.4, 2.0};
4545
if (numericAST.size() > 2) {
4646
final OptionArgs options = new OptionArgs(numericAST.topHead(), numericAST, 2, engine);

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/interfaces/IExpr.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1216,16 +1216,16 @@ default IExpr.COMPARE_TERNARY equalTernary(IExpr that, EvalEngine engine) {
12161216
IExpr arg1 = this;
12171217
IExpr arg2 = that;
12181218
if (!arg1.isReal() && arg1.isNumericFunction(x -> x.isDirectedInfinity() ? "" : null)) {
1219-
arg1 = engine.evalN(arg1);
1219+
arg1 = engine.evalNumericFunction(arg1);
12201220
}
12211221
if (!arg2.isReal() && arg2.isNumericFunction(x -> x.isDirectedInfinity() ? "" : null)) {
1222-
arg2 = engine.evalN(arg2);
1222+
arg2 = engine.evalNumericFunction(arg2);
12231223
}
12241224
if (arg2.isInexactNumber() && arg1.isExactNumber()) {
1225-
arg1 = engine.evalN(arg1);
1225+
arg1 = engine.evalNumericFunction(arg1);
12261226
}
12271227
if (arg1.isInexactNumber() && arg2.isExactNumber()) {
1228-
arg2 = engine.evalN(arg2);
1228+
arg2 = engine.evalNumericFunction(arg2);
12291229
}
12301230

12311231
if (isSame(that)) {
@@ -1443,7 +1443,7 @@ default IExpr evalNIL(EvalEngine engine) {
14431443
*/
14441444
default INumber evalNumber() {
14451445
if (isNumber()) {
1446-
IExpr result = EvalEngine.get().evalN(this);
1446+
IExpr result = EvalEngine.get().evalNumericFunction(this);
14471447
if (result.isNumber()) {
14481448
return (INumber) result;
14491449
}

0 commit comments

Comments
 (0)