Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
b74f5aed
Commit
b74f5aed
authored
Jun 13, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied temporary fix from previous commit to definite integral bounds too.
parent
719fc68d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
src/node.py
src/node.py
+20
-19
No files found.
src/node.py
View file @
b74f5aed
...
...
@@ -339,35 +339,36 @@ class ExpressionNode(Node, ExpressionBase):
# Add bounds
if len(self) > 2:
lbnd, ubnd = self[2:]
# FIXME: temporary fix: add parentheses around negated bounds to
# prevent a syntax error (solving the syntax error is better, but
# harder)
if lbnd.negated:
lbnds = '
%
s
(
%
s
)
' % (OP_VALUE_MAP[OP_SUBSCRIPT], lbnd)
else:
lbnds = str(ExpressionNode(OP_SUBSCRIPT, lbnd))
if ubnd.negated:
ubnds = '
%
s
(
%
s
)
' % (OP_VALUE_MAP[OP_POW], ubnd)
else:
ubnds = str(ExpressionNode(OP_POW, ubnd))
op += lbnds + ubnds
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)
if lbnd.negated:
lbnds = '
%
s
(
%
s
)
' % (OP_VALUE_MAP[OP_SUBSCRIPT], lbnd)
else:
lbnds = str(ExpressionNode(OP_SUBSCRIPT, lbnd))
if ubnd.negated:
ubnds = '
%
s
(
%
s
)
' % (OP_VALUE_MAP[OP_POW], ubnd)
else:
ubnds = str(ExpressionNode(OP_POW, ubnd))
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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment