from sympy.printing.repr import srepr from sympy.utilities.decorator import doctest_depends_on matchpy = import_module("matchpy") if matchpy: from matchpy import Operation, CommutativeOperation, AssociativeOperation, OneIdentityOperation from matchpy.expressions.functions import op_iter, create_operation_expression, op_len Operation.register(Integral) Operation.register(Pow) OneIdentityOperation.register(Pow) Operation.register(Add) OneIdentityOperation.register(Add) CommutativeOperation.register(Add) AssociativeOperation.register(Add) Operation.register(Mul) OneIdentityOperation.register(Mul) CommutativeOperation.register(Mul) AssociativeOperation.register(Mul) Operation.register(Equality) CommutativeOperation.register(Equality) Operation.register(Unequality) CommutativeOperation.register(Unequality) Operation.register(exp) Operation.register(log) Operation.register(gamma)
ProductLog, PolyGamma, rubi_unevaluated_expr, process_trig) Operation.register(Integral) register_operation_iterator(Integral, lambda a: (a._args[0], ) + a._args[1], lambda a: len( (a._args[0], ) + a._args[1])) Operation.register(Pow) OneIdentityOperation.register(Pow) register_operation_iterator(Pow, lambda a: a._args, lambda a: len(a._args)) Operation.register(Add) OneIdentityOperation.register(Add) CommutativeOperation.register(Add) AssociativeOperation.register(Add) register_operation_iterator(Add, lambda a: a._args, lambda a: len(a._args)) Operation.register(Mul) OneIdentityOperation.register(Mul) CommutativeOperation.register(Mul) AssociativeOperation.register(Mul) register_operation_iterator(Mul, lambda a: a._args, lambda a: len(a._args)) Operation.register(exp) register_operation_iterator(exp, lambda a: a._args, lambda a: len(a._args)) Operation.register(log) register_operation_iterator(log, lambda a: a._args, lambda a: len(a._args))
from sympy import Pow, Add, Integral, Basic, Mul, S from sympy.functions import (log, sin, cos, tan, cot, csc, sec, sqrt, erf, exp, log, gamma, acosh, asinh, atanh, acoth, acsch, asech, cosh, sinh, tanh, coth, sech, csch, atan, acsc, asin, acot, acos, asec, fresnels, fresnelc, erfc, erfi) Operation.register(Integral) register_operation_iterator(Integral, lambda a: (a._args[0],) + a._args[1], lambda a: len((a._args[0],) + a._args[1])) Operation.register(Pow) OneIdentityOperation.register(Pow) register_operation_iterator(Pow, lambda a: a._args, lambda a: len(a._args)) Operation.register(Add) OneIdentityOperation.register(Add) CommutativeOperation.register(Add) AssociativeOperation.register(Add) register_operation_iterator(Add, lambda a: a._args, lambda a: len(a._args)) Operation.register(Mul) OneIdentityOperation.register(Mul) CommutativeOperation.register(Mul) AssociativeOperation.register(Mul) register_operation_iterator(Mul, lambda a: a._args, lambda a: len(a._args)) Operation.register(exp) register_operation_iterator(exp, lambda a: a._args, lambda a: len(a._args)) Operation.register(log) register_operation_iterator(log, lambda a: a._args, lambda a: len(a._args))