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
fcfc7cef
Commit
fcfc7cef
authored
Apr 19, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed no possibilities when trying to apply sum rule.
parent
76db9913
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
src/rules/derivatives.py
src/rules/derivatives.py
+6
-3
tests/test_rules_derivatives.py
tests/test_rules_derivatives.py
+1
-1
No files found.
src/rules/derivatives.py
View file @
fcfc7cef
...
@@ -340,10 +340,13 @@ def match_sum_product_rule(node):
...
@@ -340,10 +340,13 @@ def match_sum_product_rule(node):
x
=
L
(
x
)
x
=
L
(
x
)
functions
=
[
n
for
n
in
scope
if
n
.
contains
(
x
)]
functions
=
[
n
for
n
in
scope
if
n
.
contains
(
x
)]
if
node
[
0
].
op
==
OP_MUL
:
if
len
(
functions
)
<
2
:
if
len
(
functions
)
<
2
:
return
[]
return
[]
handler
=
sum_rule
if
node
[
0
].
op
==
OP_ADD
else
product_rule
handler
=
product_rule
else
:
handler
=
sum_rule
return
[
P
(
node
,
handler
,
(
scope
,
f
))
for
f
in
functions
]
return
[
P
(
node
,
handler
,
(
scope
,
f
))
for
f
in
functions
]
...
...
tests/test_rules_derivatives.py
View file @
fcfc7cef
...
@@ -208,7 +208,7 @@ class TestRulesDerivatives(RulesTestCase):
...
@@ -208,7 +208,7 @@ class TestRulesDerivatives(RulesTestCase):
P
(
root
,
product_rule
,
(
Scope
(
f
),
x
))])
P
(
root
,
product_rule
,
(
Scope
(
f
),
x
))])
def
test_match_sum_product_rule_none
(
self
):
def
test_match_sum_product_rule_none
(
self
):
root
=
tree
(
'der(
x ^
2 + 2)'
)
root
=
tree
(
'der(2 + 2)'
)
self
.
assertEqualPos
(
match_sum_product_rule
(
root
),
[])
self
.
assertEqualPos
(
match_sum_product_rule
(
root
),
[])
root
=
tree
(
'der(x ^ 2 * 2)'
)
root
=
tree
(
'der(x ^ 2 * 2)'
)
...
...
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