Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit e2d74c6

Browse files
committed
parse unevaluated expression in EN and FR
1 parent 46a728a commit e2d74c6

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/sage/calculus/calculus.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ def laplace(ex, t, s, algorithm='maxima'):
13901390
sage: laplace(heaviside(t-1), t, s, algorithm='sympy')
13911391
(e^(-s)/s, 0, True)
13921392
1393-
TESTS::
1393+
TESTS:
13941394
13951395
Testing Giac::
13961396
@@ -1399,15 +1399,14 @@ def laplace(ex, t, s, algorithm='maxima'):
13991399
sage: laplace(5*cos(3*t-2)*heaviside(t-2), t, s, algorithm='giac')
14001400
5*(s*cos(4)*e^(-2*s) - 3*e^(-2*s)*sin(4))/(s^2 + 9)
14011401
1402-
Testing unevaluated expression from Giac::
1402+
Check unevaluated expression from Giac (it is locale-dependent, see
1403+
:trac:`22833`)::
14031404
14041405
sage: var('n')
14051406
n
14061407
sage: laplace(t^n, t, s, algorithm='giac')
1407-
Traceback (most recent call last):
1408-
...
1409-
NotImplementedError: Unable to parse Giac output: integrate(t^n*exp(-s*t),t,0,+infinity)
1410-
1408+
laplace(t^n, t, s)
1409+
14111410
Testing SymPy::
14121411
14131412
sage: laplace(t^n, t, s, algorithm='sympy')
@@ -1454,7 +1453,10 @@ def laplace(ex, t, s, algorithm='maxima'):
14541453
result = giac.laplace(ex, t, s)
14551454
except TypeError:
14561455
raise ValueError("Giac cannot make sense of: %s" % ex_gi)
1457-
return result.sage()
1456+
if 'integrate' in format(result) or 'integration' in format(result):
1457+
return dummy_laplace(ex, t, s)
1458+
else:
1459+
return result.sage()
14581460

14591461
else:
14601462
raise ValueError("Unknown algorithm: %s" % algorithm)

src/sage/symbolic/integration/integral.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def __init__(self):
6262
# creating a subclasses which define a different set of integrators
6363
self.integrators = [external.maxima_integrator]
6464

65-
BuiltinFunction.__init__(self, "integrate", nargs=2, conversions={'sympy': 'Integral'})
65+
BuiltinFunction.__init__(self, "integrate", nargs=2, conversions={'sympy': 'Integral',
66+
'giac': 'integrate'})
6667

6768
def _eval_(self, f, x):
6869
"""
@@ -150,7 +151,8 @@ def __init__(self):
150151
# creating a subclasses which define a different set of integrators
151152
self.integrators = [external.maxima_integrator]
152153

153-
BuiltinFunction.__init__(self, "integrate", nargs=4, conversions={'sympy': 'Integral'})
154+
BuiltinFunction.__init__(self, "integrate", nargs=4, conversions={'sympy': 'Integral',
155+
'giac': 'integrate'})
154156

155157
def _eval_(self, f, x, a, b):
156158
"""

0 commit comments

Comments
 (0)