Skip to content

Commit 5bec044

Browse files
committed
add missing Simplify template for (very incomplete) Sympy simplify.py
1 parent e80ed61 commit 5bec044

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

  • symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/sympy/simplify
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.matheclipse.core.sympy.simplify;
2+
3+
import org.matheclipse.core.interfaces.IAST;
4+
import org.matheclipse.core.interfaces.IASTMutable;
5+
import org.matheclipse.core.interfaces.IExpr;
6+
7+
public class Simplify {
8+
public static IExpr logCombine(IExpr expr) {
9+
return logCombine(expr, false);
10+
}
11+
12+
public static IExpr logCombine(IExpr expr, boolean force) {
13+
if (expr.isPlus()) {
14+
return expr;
15+
}
16+
if (expr.isTimes()) {
17+
IAST timesAST = (IAST) expr;
18+
int indexOf = timesAST.indexOf(IExpr::isLog);
19+
if (indexOf < 0) {
20+
return expr;
21+
}
22+
if (timesAST.get(indexOf).first().isPositiveResult()) {
23+
IASTMutable timesReduced = timesAST.removeAtCopy(indexOf);
24+
for (int i = 1; i < timesReduced.size(); i++) {
25+
IExpr arg = timesReduced.get(i);
26+
if (arg.isRealResult()) {
27+
28+
}
29+
}
30+
}
31+
}
32+
return expr;
33+
}
34+
}

0 commit comments

Comments
 (0)