Skip to content

Commit cb28946

Browse files
Merge pull request #213 from lambda-feedback/tr186-add-integral-as-elementary-function
Added Integral as an elementary function
2 parents 614e258 + 86197e1 commit cb28946

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

app/expression_utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _print_log(self, expr, exp=None):
4545
('exp', ['Exp']), ('E', ['e']), ('log', ['ln']),
4646
('sqrt', []), ('sign', []), ('Abs', ['abs']), ('Max', ['max']), ('Min', ['min']), ('arg', []), ('ceiling', ['ceil']), ('floor', []),
4747
# Below this line should probably not be collected with elementary functions. Some like 'common operations' would be a better name
48-
('summation', ['sum','Sum']), ('Derivative', ['diff']), ('re', ['real']), ('im', ['imag']), ('conjugate', ['conj'])
48+
('summation', ['sum','Sum']), ('Derivative', ['diff']), ('Integral', ['int']), ('re', ['real']), ('im', ['imag']), ('conjugate', ['conj'])
4949
]
5050
for data in elementary_functions_names:
5151
upper_case_alternatives = [data[0].upper()]

app/symbolic_comparison_evaluation_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,5 +1574,25 @@ def test_alternatives_to_input_symbols_takes_priority_over_elementary_function_a
15741574
result = evaluation_function(response, answer, params)
15751575
assert result["is_correct"] is False
15761576

1577+
def test_integral(self):
1578+
response = "6y"
1579+
answer = "int(3*x*y, (x, 0, 2))"
1580+
params = {
1581+
"strict_syntax": False,
1582+
"elementary_functions": True,
1583+
}
1584+
result = evaluation_function(response, answer, params)
1585+
assert result["is_correct"] is True
1586+
1587+
def test_abstract_integral(self):
1588+
response = "int(f(x)+g(x), (x, a, b))"
1589+
answer = "int(g(x)+f(x), (x, a, b))"
1590+
params = {
1591+
"strict_syntax": False,
1592+
"elementary_functions": True,
1593+
}
1594+
result = evaluation_function(response, answer, params)
1595+
assert result["is_correct"] is True
1596+
15771597
if __name__ == "__main__":
15781598
pytest.main(['-xk not slow', "--tb=line", '--durations=10', os.path.abspath(__file__)])

0 commit comments

Comments
 (0)