Commit 8600bb1f authored by Taddeus Kroes's avatar Taddeus Kroes

More source code cleanup.

parent f846f9e7
...@@ -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]
......
...@@ -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)
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