Commit 2a3e3ec6 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Lowered precedences of expansion and exponent extension

parent 63b9dd96
...@@ -24,7 +24,7 @@ from .negation import double_negation, negated_factor, negated_nominator, \ ...@@ -24,7 +24,7 @@ from .negation import double_negation, negated_factor, negated_nominator, \
from .fractions import multiply_with_fraction, divide_fraction_by_term, \ from .fractions import multiply_with_fraction, divide_fraction_by_term, \
add_nominators, division_by_one add_nominators, division_by_one
from .integrals import factor_out_constant, integrate_variable_root from .integrals import factor_out_constant, integrate_variable_root
from .powers import remove_power_of_one from .powers import remove_power_of_one, extend_exponent
from .sqrt import quadrant_sqrt, extract_sqrt_mult_priority from .sqrt import quadrant_sqrt, extract_sqrt_mult_priority
from .lineq import substitute_variable, swap_sides, divide_term, multiply_term from .lineq import substitute_variable, swap_sides, divide_term, multiply_term
from .groups import combine_groups from .groups import combine_groups
...@@ -62,13 +62,20 @@ LOW = [ ...@@ -62,13 +62,20 @@ LOW = [
factor_in_exponent_multiplicant, factor_in_exponent_multiplicant,
reduce_fraction_constants, reduce_fraction_constants,
# These rules lead to a longer expression, and are therefore not
# preferred as a first step
# Expand 'single' before 'double' to avoid unnessecary complexity
extend_exponent,
expand_single,
expand_double,
# Sorting expression terms has a low priority because it is assumed to # Sorting expression terms has a low priority because it is assumed to
# be handled by the user # be handled by the user
swap_factors, swap_factors,
] ]
# Fucntion precedences relative to eachother. Tuple (A, B) means that A has a # Function precedences relative to eachother. Tuple (A, B) means that A has a
# higher priority than B. This list ignores occurences in the HIGH or LOW lists # higher priority than B. This list ignores occurences in the HIGH or LOW lists
# above # above
RELATIVE = [ RELATIVE = [
...@@ -76,10 +83,6 @@ RELATIVE = [ ...@@ -76,10 +83,6 @@ RELATIVE = [
(chain_rule, raised_base), (chain_rule, raised_base),
(raised_base, factor_out_exponent), (raised_base, factor_out_exponent),
# Combine groups before expanding them
# Expand 'single' before 'double' to avoid unnessecary complexity
(expand_single, expand_double),
(factor_out_exponent_important, raise_numerics), (factor_out_exponent_important, raise_numerics),
(factor_out_constant, multiply_with_fraction), (factor_out_constant, multiply_with_fraction),
...@@ -104,7 +107,7 @@ RELATIVE = [ ...@@ -104,7 +107,7 @@ RELATIVE = [
# When solving of an equation with constants, expanding an equation has # When solving of an equation with constants, expanding an equation has
# a lower priority # a lower priority
(divide_term, multiply_term, swap_sides, expand_double, expand_single), (divide_term, multiply_term, swap_sides),
] ]
......
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