__init__.py 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. from ..node import OP_ADD, OP_MUL, OP_DIV, OP_POW, OP_NEG, OP_SIN, OP_COS, \
  2. OP_TAN, OP_DER, OP_LOG, OP_INT, OP_INT_INDEF, OP_EQ, OP_ABS
  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_raised_fraction, match_remove_negative_exponent, \
  8. match_exponent_to_root, match_extend_exponent, match_constant_exponent
  9. from .numerics import match_add_numerics, match_divide_numerics, \
  10. match_multiply_numerics, match_multiply_zero, match_raise_numerics
  11. from .fractions import match_constant_division, match_add_fractions, \
  12. match_multiply_fractions, match_divide_fractions, \
  13. match_extract_fraction_terms
  14. from .negation import match_negated_factor, match_negate_polynome, \
  15. match_negated_division
  16. from .sort import match_sort_multiplicants
  17. from .goniometry import match_add_quadrants, match_negated_parameter, \
  18. match_half_pi_subtraction, match_standard_radian
  19. from .derivatives import match_zero_derivative, \
  20. match_one_derivative, match_variable_power, \
  21. match_const_deriv_multiplication, match_logarithmic, \
  22. match_goniometric, match_sum_product_rule, match_quotient_rule
  23. from .logarithmic import match_constant_logarithm, \
  24. match_add_logarithms, match_raised_base, match_factor_out_exponent, \
  25. match_factor_in_multiplicant, match_expand_terms
  26. from .integrals import match_solve_indef, match_constant_integral, \
  27. match_integrate_variable_power, match_factor_out_constant, \
  28. match_division_integral, match_function_integral, \
  29. match_sum_rule_integral, match_remove_indef_constant
  30. from .lineq import match_move_term
  31. from .absolute import match_factor_out_abs_term
  32. RULES = {
  33. OP_ADD: [match_add_numerics, match_add_fractions,
  34. match_combine_groups, match_add_quadrants,
  35. match_add_logarithms],
  36. OP_MUL: [match_multiply_numerics, match_expand, match_add_exponents,
  37. match_multiply_zero, match_negated_factor,
  38. match_sort_multiplicants, match_multiply_fractions,
  39. match_factor_in_multiplicant],
  40. OP_DIV: [match_subtract_exponents, match_divide_numerics,
  41. match_constant_division, match_divide_fractions,
  42. match_negated_division, match_extract_fraction_terms],
  43. OP_POW: [match_multiply_exponents, match_duplicate_exponent,
  44. match_raised_fraction, match_remove_negative_exponent,
  45. match_exponent_to_root, match_extend_exponent,
  46. match_constant_exponent, match_raise_numerics,
  47. match_raised_base],
  48. OP_NEG: [match_negate_polynome],
  49. OP_SIN: [match_negated_parameter, match_half_pi_subtraction,
  50. match_standard_radian],
  51. OP_COS: [match_negated_parameter, match_half_pi_subtraction,
  52. match_standard_radian],
  53. OP_TAN: [match_standard_radian],
  54. OP_DER: [match_zero_derivative, match_one_derivative,
  55. match_variable_power, match_const_deriv_multiplication,
  56. match_logarithmic, match_goniometric, match_sum_product_rule,
  57. match_quotient_rule],
  58. OP_LOG: [match_constant_logarithm, match_factor_out_exponent,
  59. match_expand_terms],
  60. OP_INT: [match_integrate_variable_power, match_constant_integral,
  61. match_factor_out_constant, match_division_integral,
  62. match_function_integral, match_sum_rule_integral],
  63. OP_INT_INDEF: [match_remove_indef_constant, match_solve_indef],
  64. OP_EQ: [match_move_term],
  65. OP_ABS: [match_factor_out_abs_term],
  66. }