use of org.matheclipse.core.polynomials.PartialFractionGenerator in project symja_android_library by axkr.
the class Limit method timesLimit.
private static IExpr timesLimit(final IAST timesAST, LimitData data) {
IAST isFreeResult = timesAST.partitionTimes(Predicates.isFree(data.getSymbol()), F.C1, F.C1, F.List);
if (!isFreeResult.get(1).isOne()) {
return F.Times(isFreeResult.get(1), data.limit(isFreeResult.get(2)));
}
IExpr[] parts = Algebra.fractionalPartsTimesPower(timesAST, false, false, true, true);
if (parts != null) {
IExpr numerator = parts[0];
IExpr denominator = parts[1];
IExpr limit = data.getLimitValue();
ISymbol symbol = data.getSymbol();
if (limit.isInfinity() || limit.isNegativeInfinity()) {
try {
ExprPolynomialRing ring = new ExprPolynomialRing(symbol);
ExprPolynomial denominatorPoly = ring.create(denominator);
ExprPolynomial numeratorPoly = ring.create(numerator);
return limitsInfinityOfRationalFunctions(numeratorPoly, denominatorPoly, symbol, limit, data);
} catch (RuntimeException e) {
if (Config.DEBUG) {
e.printStackTrace();
}
}
}
IExpr plusResult = Algebra.partialFractionDecompositionRational(new PartialFractionGenerator(), parts, symbol);
if (plusResult.isPlus()) {
// if (plusResult.size() > 2) {
return data.mapLimit((IAST) plusResult);
// }
}
if (denominator.isOne()) {
if (limit.isInfinity() || limit.isNegativeInfinity()) {
IExpr temp = substituteInfinity(timesAST, data);
if (temp.isPresent()) {
return temp;
}
}
}
IExpr temp = numeratorDenominatorLimit(numerator, denominator, data);
if (temp.isPresent()) {
return temp;
}
}
return data.mapLimit(timesAST);
}
Aggregations