Fixed missing import and fixed negative multiplication

parent 0fc76d9a
...@@ -5,7 +5,7 @@ from .factors import match_expand ...@@ -5,7 +5,7 @@ from .factors import match_expand
from .powers import match_add_exponents, match_subtract_exponents, \ from .powers import match_add_exponents, match_subtract_exponents, \
match_multiply_exponents, match_duplicate_exponent, \ match_multiply_exponents, match_duplicate_exponent, \
match_remove_negative_exponent, match_exponent_to_root match_remove_negative_exponent, match_exponent_to_root
from .numerics import match_divide_numerics from .numerics import match_divide_numerics, match_multiply_numerics
from .fractions import match_constant_division, match_add_constant_fractions, \ from .fractions import match_constant_division, match_add_constant_fractions, \
match_expand_and_add_fractions match_expand_and_add_fractions
...@@ -13,7 +13,7 @@ from .fractions import match_constant_division, match_add_constant_fractions, \ ...@@ -13,7 +13,7 @@ from .fractions import match_constant_division, match_add_constant_fractions, \
RULES = { RULES = {
OP_ADD: [match_add_constant_fractions, match_combine_polynomes, \ OP_ADD: [match_add_constant_fractions, match_combine_polynomes, \
match_combine_groups], match_combine_groups],
OP_MUL: [match_expand, match_add_exponents, \ OP_MUL: [match_multiply_numerics, match_expand, match_add_exponents, \
match_expand_and_add_fractions], match_expand_and_add_fractions],
OP_DIV: [match_subtract_exponents, match_divide_numerics, \ OP_DIV: [match_subtract_exponents, match_divide_numerics, \
match_constant_division], match_constant_division],
......
...@@ -123,7 +123,7 @@ def match_multiply_numerics(node): ...@@ -123,7 +123,7 @@ def match_multiply_numerics(node):
if n.is_numeric(): if n.is_numeric():
numerics.append((n, n.value)) numerics.append((n, n.value))
elif n.is_op(OP_NEG) and n[0].is_numeric(): elif n.is_op(OP_NEG) and n[0].is_numeric():
numerics.append((n, n[0].value)) numerics.append((n, -n[0].value))
for (n0, v0), (n1, v1) in combinations(numerics, 2): for (n0, v0), (n1, v1) in combinations(numerics, 2):
p.append(P(node, multiply_numerics, (n0, n1, v0, v1))) p.append(P(node, multiply_numerics, (n0, n1, v0, v1)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment