Skip to content

Commit

Permalink
Merge branch 'sympy' into sympy-1.12-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed May 22, 2023
2 parents 6ba0eaf + aa4193c commit 19c14eb
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/sage/calculus/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1690,8 +1690,11 @@ def laplace(ex, t, s, algorithm='maxima'):
Testing SymPy::
sage: laplace(t^n, t, s, algorithm='sympy')
(gamma(n + 1)/(s*s^n), 0, re(n) > -1)
sage: F, a, cond = laplace(t^n, t, s, algorithm='sympy')
sage: a, cond
(0, re(n) > -1)
sage: F.simplify()
s^(-n - 1)*gamma(n + 1)
Testing Maxima::
Expand All @@ -1700,17 +1703,19 @@ def laplace(ex, t, s, algorithm='maxima'):
Check that :trac:`24212` is fixed::
sage: laplace(cos(t^2), t, s, algorithm='sympy')
(-1/2*sqrt(pi)*(sqrt(2)*cos(1/4*s^2)*fresnel_sin(1/2*sqrt(2)*s/sqrt(pi)) -
sqrt(2)*fresnel_cos(1/2*sqrt(2)*s/sqrt(pi))*sin(1/4*s^2) - cos(1/4*pi + 1/4*s^2)),
0, True)
sage: F, a, cond = laplace(cos(t^2), t, s, algorithm='sympy')
sage: a, cond
(0, True)
sage: F._sympy_().simplify()
sqrt(pi)*(sqrt(2)*sin(s**2/4)*fresnelc(sqrt(2)*s/(2*sqrt(pi))) -
sqrt(2)*cos(s**2/4)*fresnels(sqrt(2)*s/(2*sqrt(pi))) + cos(s**2/4 + pi/4))/2
Testing result from SymPy that Sage doesn't know how to handle::
sage: laplace(cos(-1/t), t, s, algorithm='sympy')
Traceback (most recent call last):
...
AttributeError: Unable to convert SymPy result (=meijerg(((), ()), ((-1/2, 0, 1/2), (0,)), s**2/16)/4) into Sage
AttributeError: Unable to convert SymPy result (=meijerg(((), ()), ((-1/2, 0, 1/2), (0,)), ...)/4) into Sage
"""
if not isinstance(ex, (Expression, Function)):
ex = SR(ex)
Expand Down Expand Up @@ -1817,8 +1822,8 @@ def inverse_laplace(ex, s, t, algorithm='maxima'):
Transform an expression involving a time-shift, via SymPy::
sage: inverse_laplace(1/s^2*exp(-s), s, t, algorithm='sympy')
-(log(e^(-t)) + 1)*heaviside(t - 1)
sage: inverse_laplace(1/s^2*exp(-s), s, t, algorithm='sympy').simplify()
(t - 1)*heaviside(t - 1)
The same instance with Giac::
Expand Down

0 comments on commit 19c14eb

Please sign in to comment.