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
bd6d26a6
Commit
bd6d26a6
authored
Apr 19, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some code coverage fixes.
parent
2eb3b7cb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
+20
-16
src/rules/derivatives.py
src/rules/derivatives.py
+6
-9
tests/test_rules_integrals.py
tests/test_rules_integrals.py
+14
-7
No files found.
src/rules/derivatives.py
View file @
bd6d26a6
...
...
@@ -155,23 +155,20 @@ def match_variable_power(node):
evars
=
find_variables
(
exponent
)
x
=
get_derivation_variable
(
node
,
rvars
|
evars
)
if
x
in
rvars
and
x
in
evars
:
if
x
in
rvars
:
if
x
in
evars
:
return
[
P
(
node
,
power_rule
)]
if
x
in
rvars
:
if
root
.
is_variable
():
return
[
P
(
node
,
variable_root
)]
return
[
P
(
node
,
chain_rule
,
(
root
,
variable_root
,
()))]
if
x
in
evars
:
if
exponent
.
is_variable
():
return
[
P
(
node
,
variable_exponent
)]
return
[
P
(
node
,
chain_rule
,
(
exponent
,
variable_exponent
,
()))]
return
[]
def
power_rule
(
root
,
args
):
"""
...
...
tests/test_rules_integrals.py
View file @
bd6d26a6
...
...
@@ -132,13 +132,20 @@ class TestRulesIntegrals(RulesTestCase):
])
def
test_match_function_integral
(
self
):
root0
,
root1
,
root2
=
tree
(
'int ln x, int sin x, int cos x'
)
self
.
assertEqualPos
(
match_function_integral
(
root0
),
[
P
(
root0
,
logarithm_integral
)])
self
.
assertEqualPos
(
match_function_integral
(
root1
),
[
P
(
root1
,
sinus_integral
)])
self
.
assertEqualPos
(
match_function_integral
(
root2
),
[
P
(
root2
,
cosinus_integral
)])
root
=
tree
(
'int ln x'
)
self
.
assertEqualPos
(
match_function_integral
(
root
),
[
P
(
root
,
logarithm_integral
)])
root
=
tree
(
'int sin x'
)
self
.
assertEqualPos
(
match_function_integral
(
root
),
[
P
(
root
,
sinus_integral
)])
root
=
tree
(
'int cos x'
)
self
.
assertEqualPos
(
match_function_integral
(
root
),
[
P
(
root
,
cosinus_integral
)])
root
=
tree
(
'int sqrt x'
)
self
.
assertEqualPos
(
match_function_integral
(
root
),
[])
def
test_logarithm_integral
(
self
):
root
,
expect
=
tree
(
'int ln x, (xlnx - x) / ln e + 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