Commit a793a96a authored by Taddeus Kroes's avatar Taddeus Kroes

Uppercase variables are now put at the end of a polynome, and the start of a monomial.

parent 1e478565
......@@ -21,7 +21,7 @@ def choose_constant(integral):
i += 2 if i == 98 else 1
c = chr(i)
return L(c)
return L(c.upper())
def solve_integral(integral, F):
......
......@@ -26,6 +26,10 @@ def get_power_prop(node):
return root.value, exp
def is_upper(character):
return 'A' <= character <= 'Z'
def swap_mono((left, right)):
"""
Check if a pair of left and right multiplication factors in a monomial
......@@ -46,6 +50,9 @@ def swap_mono((left, right)):
# Same variable, compare exponents
return left_exp > right_exp
if is_upper(left_var) != is_upper(right_var):
return is_upper(left_var) < is_upper(right_var)
# Compare variable names alphabetically
return left_var > right_var
......@@ -99,6 +106,9 @@ def swap_poly((left, right)):
# Same variable, compare exponents
return left_exp < right_exp
if is_upper(left_var) != is_upper(right_var):
return is_upper(left_var) > is_upper(right_var)
# Compare variable names alphabetically
return left_var > right_var
......
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