Skip to content

Commit 2a6b051

Browse files
Merge pull request #215 from lambda-feedback/tr186-add-integral-as-elementary-function
Fixed regression after major update
2 parents c817738 + ddfa7f9 commit 2a6b051

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

app/tests/symbolic_evaluation_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,5 +1960,25 @@ def test_input_symbols_takes_priority_when_containing_elementary_function_names_
19601960
result = evaluation_function(response, answer, params)
19611961
assert result["is_correct"] is True
19621962

1963+
def test_integral(self):
1964+
response = "6y"
1965+
answer = "int(3*x*y, (x, 0, 2))"
1966+
params = {
1967+
"strict_syntax": False,
1968+
"elementary_functions": True,
1969+
}
1970+
result = evaluation_function(response, answer, params)
1971+
assert result["is_correct"] is True
1972+
1973+
def test_abstract_integral(self):
1974+
response = "int(f(x)+g(x), (x, a, b))"
1975+
answer = "int(g(x)+f(x), (x, a, b))"
1976+
params = {
1977+
"strict_syntax": False,
1978+
"elementary_functions": True,
1979+
}
1980+
result = evaluation_function(response, answer, params)
1981+
assert result["is_correct"] is True
1982+
19631983
if __name__ == "__main__":
19641984
pytest.main(['-xk not slow', "--tb=line", '--durations=10', os.path.abspath(__file__)])

app/utility/expression_utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _print_log(self, expr, exp=None):
6262
# Special symbols to make sure plus_minus and minus_plus are not destroyed during preprocessing
6363
('plus_minus', []), ('minus_plus', []),
6464
# Below this line should probably not be collected with elementary functions. Some like 'common operations' would be a better name
65-
('summation', ['sum', 'Sum']), ('Derivative', ['diff']), ('re', ['real']), ('im', ['imag']), ('conjugate', ['conj'])
65+
('summation', ['sum', 'Sum']), ('Integral', ['int']), ('Derivative', ['diff']), ('re', ['real']), ('im', ['imag']), ('conjugate', ['conj'])
6666
]
6767
for data in elementary_functions_names:
6868
upper_case_alternatives = [data[0].upper()]

0 commit comments

Comments
 (0)