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