use of org.matheclipse.core.eval.util.Options in project symja_android_library by axkr.
the class NFourierTransform method evaluate.
@Override
public IExpr evaluate(final IAST ast, EvalEngine engine) {
Validate.checkRange(ast, 4, 5);
IExpr expr = ast.arg1();
ISymbol t = Validate.checkSymbolType(ast, 2);
// IExpr omega = ast.arg3();
if (ast.size() > 4) {
final Options options = new Options(ast.topHead(), ast, 4, engine);
IExpr optionFourierParameters = options.getOption("FourierParameters");
if (optionFourierParameters.isList()) {
// analyze the parameters, if they are correct
}
}
UnivariateFunction f = new UnaryNumerical(expr, t, engine);
FastFourierTransformer fft = new FastFourierTransformer(DftNormalization.STANDARD);
org.hipparchus.complex.Complex[] result = fft.transform(f, -1.0, 1.0, 8, TransformType.FORWARD);
return Object2Expr.convertComplex(result);
}
use of org.matheclipse.core.eval.util.Options in project symja_android_library by axkr.
the class MonomialList method evaluate.
@Override
public IExpr evaluate(final IAST ast, final EvalEngine engine) {
Validate.checkRange(ast, 2, 5);
IExpr expr = F.evalExpandAll(ast.arg1());
VariablesSet eVar;
IAST symbolList = F.List();
List<IExpr> varList;
if (ast.isAST1()) {
// extract all variables from the polynomial expression
eVar = new VariablesSet(ast.arg1());
eVar.appendToList(symbolList.args());
varList = eVar.getArrayList();
} else {
symbolList = Validate.checkSymbolOrSymbolList(ast, 2);
varList = new ArrayList<IExpr>(symbolList.size() - 1);
for (int i = 1; i < symbolList.size(); i++) {
varList.add(symbolList.get(i));
}
}
TermOrder termOrder = TermOrderByName.Lexicographic;
try {
if (ast.size() > 3) {
if (ast.arg3() instanceof IStringX) {
// NegativeLexicographic
String orderStr = ast.arg3().toString();
termOrder = Options.getMonomialOrder(orderStr, termOrder);
}
final Options options = new Options(ast.topHead(), ast, 2, engine);
IExpr option = options.getOption("Modulus");
if (option.isSignedNumber()) {
return monomialListModulus(expr, varList, termOrder, option);
}
}
if (USE_JAS_POLYNOMIAL) {
return monomialList(expr, varList, termOrder);
} else {
ExprPolynomialRing ring = new ExprPolynomialRing(symbolList, new ExprTermOrder(termOrder.getEvord()));
ExprPolynomial poly = ring.create(expr);
return poly.monomialList();
}
} catch (JASConversionException jce) {
// toInt() conversion failed
if (Config.DEBUG) {
jce.printStackTrace();
}
}
return F.NIL;
}
use of org.matheclipse.core.eval.util.Options in project symja_android_library by axkr.
the class CoefficientRules method evaluate.
@Override
public IExpr evaluate(final IAST ast, final EvalEngine engine) {
Validate.checkRange(ast, 2, 5);
IExpr expr = F.evalExpandAll(ast.arg1());
VariablesSet eVar;
IAST symbolList = F.List();
List<IExpr> varList;
if (ast.isAST1()) {
// extract all variables from the polynomial expression
eVar = new VariablesSet(ast.arg1());
eVar.appendToList(symbolList.args());
varList = eVar.getArrayList();
} else {
symbolList = Validate.checkSymbolOrSymbolList(ast, 2);
varList = new ArrayList<IExpr>(symbolList.size() - 1);
for (int i = 1; i < symbolList.size(); i++) {
varList.add((ISymbol) symbolList.get(i));
}
}
TermOrder termOrder = TermOrderByName.Lexicographic;
try {
if (ast.size() > 3) {
if (ast.arg3() instanceof IStringX) {
String orderStr = ast.arg3().toString();
termOrder = Options.getMonomialOrder(orderStr, termOrder);
}
final Options options = new Options(ast.topHead(), ast, 2, engine);
IExpr option = options.getOption("Modulus");
if (option.isSignedNumber()) {
return coefficientRulesModulus(expr, varList, termOrder, option);
}
}
if (MonomialList.USE_JAS_POLYNOMIAL) {
return coefficientRules(expr, varList, termOrder);
} else {
ExprPolynomialRing ring = new ExprPolynomialRing(symbolList, new ExprTermOrder(termOrder.getEvord()));
ExprPolynomial poly = ring.create(expr);
return poly.coefficientRules();
}
} catch (JASConversionException jce) {
// toInt() conversion failed
if (Config.DEBUG) {
jce.printStackTrace();
}
}
return F.NIL;
}
use of org.matheclipse.core.eval.util.Options in project symja_android_library by axkr.
the class GroebnerBasis method evaluate.
@Override
public IExpr evaluate(final IAST ast, EvalEngine engine) {
if (ast.size() >= 3) {
if (ast.arg1().isVector() < 0 || ast.arg2().isVector() < 0) {
return F.NIL;
}
TermOrder termOrder = TermOrderByName.Lexicographic;
if (ast.size() > 3) {
final Options options = new Options(ast.topHead(), ast, ast.size() - 1, engine);
termOrder = options.getMonomialOrder(ast, termOrder);
}
IAST polys = (IAST) ast.arg1();
IAST vars = (IAST) ast.arg2();
if (vars.size() <= 1) {
return F.NIL;
}
return computeGroebnerBasis(polys, vars, termOrder);
}
return F.NIL;
}
Aggregations