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
8600bb1f
Commit
8600bb1f
authored
Mar 26, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More source code cleanup.
parent
f846f9e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
src/rules/integrals.py
src/rules/integrals.py
+4
-4
tests/test_rules_integrals.py
tests/test_rules_integrals.py
+4
-6
No files found.
src/rules/integrals.py
View file @
8600bb1f
...
@@ -72,8 +72,8 @@ def solve_integral(integral, F):
...
@@ -72,8 +72,8 @@ def solve_integral(integral, F):
def
match_integrate_variable_power
(
node
):
def
match_integrate_variable_power
(
node
):
"""
"""
int
(x ^ n, x)
-> x ^ (n + 1) / (n + 1) + c
int
x ^ n dx
-> x ^ (n + 1) / (n + 1) + c
int
(g ^ x, x)
-> g ^ x / ln(g)
int
g ^ x dx
-> g ^ x / ln(g)
"""
"""
assert
node
.
is_op
(
OP_INT
)
assert
node
.
is_op
(
OP_INT
)
...
@@ -93,7 +93,7 @@ def match_integrate_variable_power(node):
...
@@ -93,7 +93,7 @@ def match_integrate_variable_power(node):
def
integrate_variable_root
(
root
,
args
):
def
integrate_variable_root
(
root
,
args
):
"""
"""
int
(x ^ n, x)
-> x ^ (n + 1) / (n + 1) + c
int
x ^ n dx
-> x ^ (n + 1) / (n + 1) + c
"""
"""
x
,
n
=
root
[
0
]
x
,
n
=
root
[
0
]
...
@@ -106,7 +106,7 @@ MESSAGES[integrate_variable_root] = \
...
@@ -106,7 +106,7 @@ MESSAGES[integrate_variable_root] = \
def
integrate_variable_exponent
(
root
,
args
):
def
integrate_variable_exponent
(
root
,
args
):
"""
"""
int
(g ^ x, x)
-> g ^ x / ln(g)
int
g ^ x dx
-> g ^ x / ln(g)
"""
"""
g
,
x
=
root
[
0
]
g
,
x
=
root
[
0
]
...
...
tests/test_rules_integrals.py
View file @
8600bb1f
...
@@ -35,11 +35,9 @@ class TestRulesIntegrals(RulesTestCase):
...
@@ -35,11 +35,9 @@ class TestRulesIntegrals(RulesTestCase):
[
P
(
root
,
integrate_variable_exponent
)])
[
P
(
root
,
integrate_variable_exponent
)])
def
test_integrate_variable_root
(
self
):
def
test_integrate_variable_root
(
self
):
((
x
,
n
),
x
),
c
=
root
,
c
=
tree
(
'int x ^ n, c'
)
root
,
expect
=
tree
(
'int x ^ n, x ^ (n + 1) / (n + 1) + c'
)
self
.
assertEqual
(
integrate_variable_root
(
root
,
()),
self
.
assertEqual
(
integrate_variable_root
(
root
,
()),
expect
)
x
**
(
n
+
1
)
/
(
n
+
1
)
+
c
)
def
test_integrate_variable_exponent
(
self
):
def
test_integrate_variable_exponent
(
self
):
((
g
,
x
),
x
),
c
=
root
,
c
=
tree
(
'int g ^ x, c'
)
root
,
expect
=
tree
(
'int g ^ x, g ^ x / ln(g) + c'
)
self
.
assertEqual
(
integrate_variable_exponent
(
root
,
()),
self
.
assertEqual
(
integrate_variable_exponent
(
root
,
()),
expect
)
g
**
x
/
ln
(
g
)
+
c
)
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