__init__.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from ..node import OP_ADD, OP_MUL, OP_DIV, OP_POW, OP_NEG, OP_SIN, OP_COS, \
  2. OP_TAN
  3. from .groups import match_combine_groups
  4. from .factors import match_expand
  5. from .powers import match_add_exponents, match_subtract_exponents, \
  6. match_multiply_exponents, match_duplicate_exponent, \
  7. match_remove_negative_exponent, match_exponent_to_root, \
  8. match_extend_exponent, match_constant_exponent
  9. from .numerics import match_add_numerics, match_divide_numerics, \
  10. match_multiply_numerics, match_multiply_zero, match_multiply_one
  11. from .fractions import match_constant_division, match_add_constant_fractions, \
  12. match_expand_and_add_fractions
  13. from .negation import match_negated_factor, match_negate_polynome, \
  14. match_negated_division
  15. from .sort import match_sort_multiplicants
  16. from .goniometry import match_add_quadrants, match_negated_parameter, \
  17. match_half_pi_subtraction, match_standard_radian
  18. RULES = {
  19. OP_ADD: [match_add_numerics, match_add_constant_fractions,
  20. match_combine_groups, match_add_quadrants],
  21. OP_MUL: [match_multiply_numerics, match_expand, match_add_exponents,
  22. match_expand_and_add_fractions, match_multiply_zero,
  23. match_negated_factor, match_multiply_one,
  24. match_sort_multiplicants],
  25. OP_DIV: [match_subtract_exponents, match_divide_numerics,
  26. match_constant_division, match_negated_division],
  27. OP_POW: [match_multiply_exponents, match_duplicate_exponent,
  28. match_remove_negative_exponent, match_exponent_to_root,
  29. match_extend_exponent, match_constant_exponent],
  30. OP_NEG: [match_negate_polynome],
  31. OP_SIN: [match_negated_parameter, match_half_pi_subtraction,
  32. match_standard_radian],
  33. OP_COS: [match_negated_parameter, match_half_pi_subtraction,
  34. match_standard_radian],
  35. OP_TAN: [match_standard_radian],
  36. }