__init__.py 4.0 KB

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