Skip to content

Commit aa4193c

Browse files
committed
Support sympy 1.12
1 parent 8aa7213 commit aa4193c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/sage/calculus/calculus.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,8 +1690,11 @@ def laplace(ex, t, s, algorithm='maxima'):
16901690
16911691
Testing SymPy::
16921692
1693-
sage: laplace(t^n, t, s, algorithm='sympy')
1694-
(gamma(n + 1)/(s*s^n), 0, re(n) > -1)
1693+
sage: F, a, cond = laplace(t^n, t, s, algorithm='sympy')
1694+
sage: a, cond
1695+
(0, re(n) > -1)
1696+
sage: F.simplify()
1697+
s^(-n - 1)*gamma(n + 1)
16951698
16961699
Testing Maxima::
16971700
@@ -1700,17 +1703,19 @@ def laplace(ex, t, s, algorithm='maxima'):
17001703
17011704
Check that :trac:`24212` is fixed::
17021705
1703-
sage: laplace(cos(t^2), t, s, algorithm='sympy')
1704-
(-1/2*sqrt(pi)*(sqrt(2)*cos(1/4*s^2)*fresnel_sin(1/2*sqrt(2)*s/sqrt(pi)) -
1705-
sqrt(2)*fresnel_cos(1/2*sqrt(2)*s/sqrt(pi))*sin(1/4*s^2) - cos(1/4*pi + 1/4*s^2)),
1706-
0, True)
1706+
sage: F, a, cond = laplace(cos(t^2), t, s, algorithm='sympy')
1707+
sage: a, cond
1708+
(0, True)
1709+
sage: F._sympy_().simplify()
1710+
sqrt(pi)*(sqrt(2)*sin(s**2/4)*fresnelc(sqrt(2)*s/(2*sqrt(pi))) -
1711+
sqrt(2)*cos(s**2/4)*fresnels(sqrt(2)*s/(2*sqrt(pi))) + cos(s**2/4 + pi/4))/2
17071712
17081713
Testing result from SymPy that Sage doesn't know how to handle::
17091714
17101715
sage: laplace(cos(-1/t), t, s, algorithm='sympy')
17111716
Traceback (most recent call last):
17121717
...
1713-
AttributeError: Unable to convert SymPy result (=meijerg(((), ()), ((-1/2, 0, 1/2), (0,)), s**2/16)/4) into Sage
1718+
AttributeError: Unable to convert SymPy result (=meijerg(((), ()), ((-1/2, 0, 1/2), (0,)), ...)/4) into Sage
17141719
"""
17151720
if not isinstance(ex, (Expression, Function)):
17161721
ex = SR(ex)
@@ -1817,8 +1822,8 @@ def inverse_laplace(ex, s, t, algorithm='maxima'):
18171822
18181823
Transform an expression involving a time-shift, via SymPy::
18191824
1820-
sage: inverse_laplace(1/s^2*exp(-s), s, t, algorithm='sympy')
1821-
-(log(e^(-t)) + 1)*heaviside(t - 1)
1825+
sage: inverse_laplace(1/s^2*exp(-s), s, t, algorithm='sympy').simplify()
1826+
(t - 1)*heaviside(t - 1)
18221827
18231828
The same instance with Giac::
18241829

0 commit comments

Comments
 (0)