|
12 | 12 | from mathics.core.atoms import (
|
13 | 13 | String,
|
14 | 14 | Integer,
|
15 |
| - Integer0, |
16 | 15 | Integer1,
|
17 | 16 | Number,
|
18 | 17 | Rational,
|
|
28 | 27 | )
|
29 | 28 |
|
30 | 29 | from mathics.core.systemsymbols import (
|
| 30 | + SymbolIndeterminate, |
31 | 31 | SymbolPlus,
|
32 | 32 | SymbolPower,
|
33 | 33 | SymbolRule,
|
|
55 | 55 | IntegerZero = Integer(0)
|
56 | 56 | IntegerMinusOne = Integer(-1)
|
57 | 57 |
|
| 58 | +SymbolIntegrate = Symbol("Integrate") |
| 59 | + |
58 | 60 |
|
59 | 61 | class D(SympyFunction):
|
60 | 62 | """
|
@@ -594,9 +596,6 @@ def from_sympy(self, sympy_name, leaves):
|
594 | 596 |
|
595 | 597 | def apply(self, f, xs, evaluation, options):
|
596 | 598 | "Integrate[f_, xs__, OptionsPattern[]]"
|
597 |
| - self.patpow0 = Pattern.create( |
598 |
| - Expression("Power", Integer0, Expression("Blank")) |
599 |
| - ) |
600 | 599 | assuming = options["System`Assumptions"].evaluate(evaluation)
|
601 | 600 | f_sympy = f.to_sympy()
|
602 | 601 | if f_sympy is None or isinstance(f_sympy, SympyExpression):
|
@@ -688,7 +687,10 @@ def apply(self, f, xs, evaluation, options):
|
688 | 687 | else:
|
689 | 688 | result = Expression(result._head, cases, default)
|
690 | 689 | else:
|
691 |
| - result = Expression("Simplify", result, assuming).evaluate(evaluation) |
| 690 | + if result.get_head() is SymbolIntegrate: |
| 691 | + # Sympy returned the same expression, so it can't be evaluated. |
| 692 | + return SymbolIndeterminate |
| 693 | + result = Expression("Simplify", result, assuming) |
692 | 694 | return result
|
693 | 695 |
|
694 | 696 |
|
|
0 commit comments