use of org.matheclipse.core.polynomials.HornerScheme in project symja_android_library by axkr.
the class Horner method evaluate.
@Override
@Deprecated
public IExpr evaluate(final IAST ast, EvalEngine engine) {
Validate.checkSize(ast, 2);
if (ast.arg1().isAST()) {
IAST poly = (IAST) ast.arg1();
VariablesSet eVar = new VariablesSet(ast.arg1());
IAST variables = eVar.getVarList();
if (variables.size() >= 2) {
ISymbol sym = (ISymbol) variables.arg1();
if (poly.isASTSizeGE(F.Plus, 2)) {
HornerScheme scheme = new HornerScheme();
return scheme.generate(engine.isNumericMode(), poly, sym);
}
}
}
return ast.arg1();
}
use of org.matheclipse.core.polynomials.HornerScheme in project symja_android_library by axkr.
the class HornerForm method evaluate.
@Override
public IExpr evaluate(final IAST ast, EvalEngine engine) {
Validate.checkRange(ast, 2, 3);
IExpr arg1 = ast.arg1();
if (arg1.isAST()) {
IAST poly = (IAST) arg1;
VariablesSet eVar;
IAST variables;
if (ast.isAST2()) {
variables = Validate.checkSymbolOrSymbolList(ast, 2);
} else {
eVar = new VariablesSet(ast.arg1());
variables = eVar.getVarList();
}
if (variables.size() >= 2) {
ISymbol sym = (ISymbol) variables.arg1();
if (poly.isASTSizeGE(F.Plus, 2)) {
HornerScheme scheme = new HornerScheme();
return scheme.generate(engine.isNumericMode(), poly, sym);
}
}
}
return arg1;
}
Aggregations