Skip to content
Snippets Groups Projects
Commit 15ad7e94 authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

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

parent 65cc88c7
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,7 @@ def solve_indef(root, args):
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)
"""
assert node.is_op(OP_INT)
......@@ -87,11 +87,11 @@ def match_integrate_variable_power(node):
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]
return solve_integral(root, x ** (n + 1) / (n + 1))
return solve_integral(root, L(1) / (n + 1) * x ** (n + 1))
MESSAGES[integrate_variable_root] = \
......
......@@ -57,7 +57,7 @@ class TestRulesIntegrals(RulesTestCase):
[P(root, integrate_variable_exponent)])
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)
def test_integrate_variable_exponent(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment