Commit 4b2db8c0 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Fixed some negation issues in integral rules

parent a4a7af9e
......@@ -52,14 +52,16 @@ def solve_integral(integral, F):
F += choose_constant(integral)
if len(integral) < 3:
return F
solution = F
else:
x, lbnd, ubnd = integral[1:4]
x, lbnd, ubnd = integral[1:4]
if x != find_variable(F):
solution = substitute(F, x, ubnd) - substitute(F, x, lbnd)
else:
solution = indef(F, lbnd, ubnd)
if x != find_variable(F):
return substitute(F, x, ubnd) - substitute(F, x, lbnd)
return indef(F, lbnd, ubnd)
return negate(solution, integral.negated)
def match_solve_indef(node):
......@@ -78,7 +80,7 @@ def solve_indef(root, args):
Fx, a, b = root
x = find_variable(Fx)
return substitute(Fx, x, b) - substitute(Fx, x, a)
return negate(substitute(Fx, x, b) - substitute(Fx, x, a), root.negated)
def solve_indef_msg(root, args): # pragma: nocover
......@@ -386,7 +388,7 @@ def remove_indef_constant(root, args):
Fx = scope.as_nary_node()
a, b = root[1:]
return indef(Fx, a, b)
return negate(indef(Fx, a, b), root.negated)
MESSAGES[remove_indef_constant] = \
......
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