Commit b74f5aed authored by Taddeüs Kroes's avatar Taddeüs Kroes

Applied temporary fix from previous commit to definite integral bounds too.

parent 719fc68d
......@@ -339,8 +339,14 @@ class ExpressionNode(Node, ExpressionBase):
# Add bounds
if len(self) > 2:
lbnd, ubnd = self[2:]
op += self.construct_bounds(*self[2:])
# int x ^ 2 -> int x ^ 2 dx
# int x + 1 -> int (x + 1) dx
# int_a^b x ^ 2 -> int_a^b x ^ 2 dx
return op + ' ' + operand
def construct_bounds(self, lbnd, ubnd):
# FIXME: temporary fix: add parentheses around negated bounds to
# prevent a syntax error (solving the syntax error is better, but
# harder)
......@@ -354,20 +360,15 @@ class ExpressionNode(Node, ExpressionBase):
else:
ubnds = str(ExpressionNode(OP_POW, ubnd))
op += lbnds + ubnds
# int x ^ 2 -> int x ^ 2 dx
# int x + 1 -> int (x + 1) dx
# int_a^b x ^ 2 -> int_a^b x ^ 2 dx
return op + ' ' + operand
return lbnds + ubnds
def construct_indef_integral(self, children):
# [x ^ 2]_a^b
F, lbnd, ubnd = self
lbnd = str(ExpressionNode(OP_SUBSCRIPT, lbnd))
ubnd = str(ExpressionNode(OP_POW, ubnd))
#lbnd = str(ExpressionNode(OP_SUBSCRIPT, lbnd))
#ubnd = str(ExpressionNode(OP_POW, ubnd))
return '[%s]%s%s' % (F, lbnd, ubnd)
return '[%s]%s' % (F, self.construct_bounds(lbnd, ubnd))
def construct_function(self, children):
if self.op == OP_ABS:
......
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