Commit 15ad7e94 authored by Taddeus Kroes's avatar Taddeus Kroes

Changed an integral rule slightly to fit the new fraction rules better.

parent 65cc88c7
...@@ -66,7 +66,7 @@ def solve_indef(root, args): ...@@ -66,7 +66,7 @@ def solve_indef(root, args):
def match_integrate_variable_power(node): def match_integrate_variable_power(node):
""" """
int x ^ n dx -> x ^ (n + 1) / (n + 1) int x ^ n dx -> 1 / (n + 1) * x ^ (n + 1)
int g ^ x dx -> g ^ x / ln(g) int g ^ x dx -> g ^ x / ln(g)
""" """
assert node.is_op(OP_INT) assert node.is_op(OP_INT)
...@@ -87,11 +87,11 @@ def match_integrate_variable_power(node): ...@@ -87,11 +87,11 @@ def match_integrate_variable_power(node):
def integrate_variable_root(root, args): def integrate_variable_root(root, args):
""" """
int x ^ n dx -> x ^ (n + 1) / (n + 1) int x ^ n dx -> 1 / (n + 1) * x ^ (n + 1)
""" """
x, n = root[0] x, n = root[0]
return solve_integral(root, x ** (n + 1) / (n + 1)) return solve_integral(root, L(1) / (n + 1) * x ** (n + 1))
MESSAGES[integrate_variable_root] = \ MESSAGES[integrate_variable_root] = \
......
...@@ -57,7 +57,7 @@ class TestRulesIntegrals(RulesTestCase): ...@@ -57,7 +57,7 @@ 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):
root, expect = tree('int x ^ n, x ^ (n + 1) / (n + 1) + c') root, expect = tree('int x ^ n, 1 / (n + 1) * x ^ (n + 1) + c')
self.assertEqual(integrate_variable_root(root, ()), expect) self.assertEqual(integrate_variable_root(root, ()), expect)
def test_integrate_variable_exponent(self): def test_integrate_variable_exponent(self):
......
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