Example #1
0
        rules += logarithms()
        rules += special_functions()
        rules += sine()
        rules += tangent()
        rules += secant()
        rules += miscellaneous_trig()
        rules += inverse_trig()
        rules += hyperbolic()
        rules += inverse_hyperbolic()
        # rubi = piecewise_linear(rubi)
        rules += miscellaneous_integration()

        rubi = ManyToOneReplacer(*rules)
        return rubi, rules

    _E = rubi_unevaluated_expr(E)


class LoadRubiReplacer(object):
    """
    Class trick to load RUBI only once.
    """

    _instance = None

    def __new__(cls):
        if matchpy is None:
            print("MatchPy library not found")
            return None
        if LoadRubiReplacer._instance is not None:
            return LoadRubiReplacer._instance
Example #2
0
File: rubi.py Project: bjodah/sympy
        rules += miscellaneous_algebraic(rules_applied)
        rules += exponential(rules_applied)
        rules += logarithms(rules_applied)
        rules += special_functions(rules_applied)
        rules += sine(rules_applied)
        rules += tangent(rules_applied)
        rules += secant(rules_applied)
        rules += miscellaneous_trig(rules_applied)
        rules += inverse_trig(rules_applied)
        rules += hyperbolic(rules_applied)
        rules += inverse_hyperbolic(rules_applied)
        #rubi = piecewise_linear(rubi)
        rules += miscellaneous_integration(rules_applied)
        rubi = ManyToOneReplacer(*rules)
        return rubi, rules_applied, rules
    _E = rubi_unevaluated_expr(E)
    Integrate = Function('Integrate')
    rubi, rules_applied, rules = rubi_object()

def _has_cycle():
    if rules_applied.count(rules_applied[-1]) == 1:
        return False
    if rules_applied[-1] == rules_applied[-2] == rules_applied[-3] == rules_applied[-4] == rules_applied[-5]:
        return True

def process_final_integral(expr):
    '''
    When there is recursion for more than 10 rules or in total 20 rules have been applied
    rubi returns `Integrate` in order to stop any further matching. After complete integration,
    Integrate needs to be replaced back to Integral. Also rubi's `exp` need to be replaced back
    to sympy's general `exp`.