Skip to content

Commit 1a73b3b

Browse files
author
Release Manager
committed
gh-35635: Support sympy 1.12 ### 📚 Description Sympy 1.12 has been released. This PR fixes 3 failing doctests in `sage.calculus.calculus`. Tested with both 1.12 and 1.11.1. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #35635 Reported by: Gonzalo Tornaría Reviewer(s):
2 parents ad47780 + aa4193c commit 1a73b3b

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
@@ -1701,8 +1701,11 @@ def laplace(ex, t, s, algorithm='maxima'):
17011701
17021702
Testing SymPy::
17031703
1704-
sage: laplace(t^n, t, s, algorithm='sympy')
1705-
(gamma(n + 1)/(s*s^n), 0, re(n) > -1)
1704+
sage: F, a, cond = laplace(t^n, t, s, algorithm='sympy')
1705+
sage: a, cond
1706+
(0, re(n) > -1)
1707+
sage: F.simplify()
1708+
s^(-n - 1)*gamma(n + 1)
17061709
17071710
Testing Maxima::
17081711
@@ -1711,17 +1714,19 @@ def laplace(ex, t, s, algorithm='maxima'):
17111714
17121715
Check that :trac:`24212` is fixed::
17131716
1714-
sage: laplace(cos(t^2), t, s, algorithm='sympy')
1715-
(-1/2*sqrt(pi)*(sqrt(2)*cos(1/4*s^2)*fresnel_sin(1/2*sqrt(2)*s/sqrt(pi)) -
1716-
sqrt(2)*fresnel_cos(1/2*sqrt(2)*s/sqrt(pi))*sin(1/4*s^2) - cos(1/4*pi + 1/4*s^2)),
1717-
0, True)
1717+
sage: F, a, cond = laplace(cos(t^2), t, s, algorithm='sympy')
1718+
sage: a, cond
1719+
(0, True)
1720+
sage: F._sympy_().simplify()
1721+
sqrt(pi)*(sqrt(2)*sin(s**2/4)*fresnelc(sqrt(2)*s/(2*sqrt(pi))) -
1722+
sqrt(2)*cos(s**2/4)*fresnels(sqrt(2)*s/(2*sqrt(pi))) + cos(s**2/4 + pi/4))/2
17181723
17191724
Testing result from SymPy that Sage doesn't know how to handle::
17201725
17211726
sage: laplace(cos(-1/t), t, s, algorithm='sympy')
17221727
Traceback (most recent call last):
17231728
...
1724-
AttributeError: Unable to convert SymPy result (=meijerg(((), ()), ((-1/2, 0, 1/2), (0,)), s**2/16)/4) into Sage
1729+
AttributeError: Unable to convert SymPy result (=meijerg(((), ()), ((-1/2, 0, 1/2), (0,)), ...)/4) into Sage
17251730
"""
17261731
if not isinstance(ex, (Expression, Function)):
17271732
ex = SR(ex)
@@ -1828,8 +1833,8 @@ def inverse_laplace(ex, s, t, algorithm='maxima'):
18281833
18291834
Transform an expression involving a time-shift, via SymPy::
18301835
1831-
sage: inverse_laplace(1/s^2*exp(-s), s, t, algorithm='sympy')
1832-
-(log(e^(-t)) + 1)*heaviside(t - 1)
1836+
sage: inverse_laplace(1/s^2*exp(-s), s, t, algorithm='sympy').simplify()
1837+
(t - 1)*heaviside(t - 1)
18331838
18341839
The same instance with Giac::
18351840

0 commit comments

Comments
 (0)