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
da968378
Commit
da968378
authored
Feb 24, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uncommented goniometric rules.
parent
cc5d8f57
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
src/rules/goniometry.py
src/rules/goniometry.py
+14
-2
tests/test_rules_goniometry.py
tests/test_rules_goniometry.py
+1
-3
No files found.
src/rules/goniometry.py
View file @
da968378
from
..node
import
Expression
Leaf
as
L
,
Scope
,
OP_ADD
,
OP_POW
,
OP_MUL
,
\
OP_SIN
,
OP_COS
,
OP_TAN
from
..node
import
Expression
Node
as
N
,
ExpressionLeaf
as
L
,
Scope
,
OP_ADD
,
\
OP_
POW
,
OP_MUL
,
OP_
SIN
,
OP_COS
,
OP_TAN
from
..possibilities
import
Possibility
as
P
,
MESSAGES
from
..translate
import
_
def
sin
(
*
args
):
return
N
(
'sin'
,
*
args
)
def
cos
(
*
args
):
return
N
(
'cos'
,
*
args
)
def
tan
(
*
args
):
return
N
(
'tan'
,
*
args
)
def
match_add_quadrants
(
node
):
"""
sin(x) ^ 2 + cos(x) ^ 2 -> 1
...
...
tests/test_rules_goniometry.py
View file @
da968378
...
...
@@ -6,11 +6,9 @@ from tests.rulestestcase import RulesTestCase, tree
class
TestRulesGoniometry
(
RulesTestCase
):
def
test_match_add_quadrants
(
self
):
return
root
=
tree
(
'sin(x) ^ 2 + cos(x) ^ 2'
)
root
=
tree
(
'sin x ^ 2 + cos x ^ 2'
)
possibilities
=
match_add_quadrants
(
root
)
self
.
assertEqualPos
(
possibilities
,
[
P
(
root
,
add_quadrants
,
())])
def
test_add_quadrants
(
self
):
return
self
.
assertEqual
(
add_quadrants
(
None
,
()),
1
)
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