Commit da968378 authored by Taddeus Kroes's avatar Taddeus Kroes

Uncommented goniometric rules.

parent cc5d8f57
from ..node import ExpressionLeaf as L, Scope, OP_ADD, OP_POW, OP_MUL, \ from ..node import ExpressionNode as N, ExpressionLeaf as L, Scope, OP_ADD, \
OP_SIN, OP_COS, OP_TAN OP_POW, OP_MUL, OP_SIN, OP_COS, OP_TAN
from ..possibilities import Possibility as P, MESSAGES from ..possibilities import Possibility as P, MESSAGES
from ..translate import _ 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): def match_add_quadrants(node):
""" """
sin(x) ^ 2 + cos(x) ^ 2 -> 1 sin(x) ^ 2 + cos(x) ^ 2 -> 1
......
...@@ -6,11 +6,9 @@ from tests.rulestestcase import RulesTestCase, tree ...@@ -6,11 +6,9 @@ from tests.rulestestcase import RulesTestCase, tree
class TestRulesGoniometry(RulesTestCase): class TestRulesGoniometry(RulesTestCase):
def test_match_add_quadrants(self): 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) possibilities = match_add_quadrants(root)
self.assertEqualPos(possibilities, [P(root, add_quadrants, ())]) self.assertEqualPos(possibilities, [P(root, add_quadrants, ())])
def test_add_quadrants(self): def test_add_quadrants(self):
return
self.assertEqual(add_quadrants(None, ()), 1) self.assertEqual(add_quadrants(None, ()), 1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment