Commit e0a7b3a3 authored by Taddeus Kroes's avatar Taddeus Kroes Committed by Taddeüs Kroes

Integral lower bound now takes over negation fromt parent exponentiation.

parent 703d0888
...@@ -596,6 +596,7 @@ class Parser(BisonParser): ...@@ -596,6 +596,7 @@ class Parser(BisonParser):
if option == 0: # rule: INTEGRAL SUB exp if option == 0: # rule: INTEGRAL SUB exp
if values[2].is_op(OP_POW): if values[2].is_op(OP_POW):
lbnd, ubnd = values[2] lbnd, ubnd = values[2]
lbnd.negated += values[2].negated
else: else:
lbnd = values[2] lbnd = values[2]
ubnd = Leaf(INFINITY) ubnd = Leaf(INFINITY)
...@@ -667,6 +668,7 @@ class Parser(BisonParser): ...@@ -667,6 +668,7 @@ class Parser(BisonParser):
if bounds.is_op(OP_POW): if bounds.is_op(OP_POW):
lbnd, ubnd = bounds lbnd, ubnd = bounds
lbnd.negated += bounds.negated
else: else:
lbnd = bounds lbnd = bounds
ubnd = Leaf(INFINITY) ubnd = Leaf(INFINITY)
......
...@@ -168,7 +168,7 @@ class TestParser(RulesTestCase): ...@@ -168,7 +168,7 @@ class TestParser(RulesTestCase):
self.assertEqual(tree('int_a x ^ 2 dx'), integral(x ** 2, x, a, oo)) self.assertEqual(tree('int_a x ^ 2 dx'), integral(x ** 2, x, a, oo))
self.assertEqual(tree('int_(-a)^b x dx'), integral(x, x, -a, b)) self.assertEqual(tree('int_(-a)^b x dx'), integral(x, x, -a, b))
#self.assertEqual(tree('int_-a^b x dx'), integral(x, x, -a, b)) self.assertEqual(tree('int_-a^b x^2 dx'), integral(x ** 2, x, -a, b))
def test_indefinite_integral(self): def test_indefinite_integral(self):
x2, a, b, oo = tree('x ^ 2, a, b, oo') x2, a, b, oo = tree('x ^ 2, a, b, oo')
......
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