Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laplace_transform(cosh(2*x), x, s) raises RecursionError #21202

Open
MaqOwais opened this issue Mar 30, 2021 · 6 comments
Open

laplace_transform(cosh(2*x), x, s) raises RecursionError #21202

MaqOwais opened this issue Mar 30, 2021 · 6 comments

Comments

@MaqOwais
Copy link
Contributor

>>> from sympy import *
>>> from sympy.abc import x,y,z,s
>>> laplace_transform(cosh(x), x, s)
(s/(s**2 - 1), 1, True)

>>> laplace_transform(cosh(2*x), x, s)
RecursionError: maximum recursion depth exceeded while calling a Python object
skirpichev added a commit to skirpichev/diofant that referenced this issue Mar 31, 2021
skirpichev added a commit to skirpichev/diofant that referenced this issue Mar 31, 2021
@jksuom
Copy link
Member

jksuom commented Mar 31, 2021

This piece of code looks incorrect:

if len(funcs) == 1 and len(
c.xreplace({list(funcs)[0]: Dummy()}
).free_symbols) == 1:
# we can treat function like a symbol
free = funcs

It should be removed.

@hanspi42
Copy link
Contributor

Interestingly,

laplace_transform(cosh(2.0*x), x, s)

works.

@hanspi42
Copy link
Contributor

Laplace transform of cosh is now implemented properly in #22376. Comments welcome.

@hanspi42
Copy link
Contributor

@jksuom: #22376 was merged. This issue is resolved and can be closed.

@jksuom jksuom closed this as completed Jan 25, 2022
@oscarbenjamin
Copy link
Contributor

Since #22376 was merged this issue is no longer seen when calling laplace_transform. The underlying bug with simplify is still seen though:

In [5]: expr = parse_expr(
   ...:     "Piecewise((s*exp_polar(I*pi)/(4*(1 - s**2/4)), Abs(s**2)/4 < 1), (1/(s*(1 - 4/s**2)), 4/
   ...: Abs(s**2) < 1), (pi*meijerg(((1/2,), (0, 0)), ((0, 1/2), (0,)), s**2/4)/2, True))"
   ...: )

In [6]: expr
Out[6]: 
⎧              π2│    
⎪           ss │    
⎪           ──────              for ──── < 12                   44 - s                           
⎪                                           
⎪             1                      4      
⎪         ──────────            for ──── < 1
⎪           ⎛    4 ⎞                │ 2│    
⎨         s⋅⎜1 - ──⎟                │s │    
⎪           ⎜     2⎟                        
⎪           ⎝    s ⎠                        
⎪                                           
⎪          ⎛             │  2⎞              
⎪  ╭─╮2, 11/2    0, 0s ⎟              
⎪π⋅│╶┐     ⎜             │ ──⎟              
⎪  ╰─╯3, 30, 1/2   04 ⎠              
⎪─────────────────────────────   otherwise2                            

In [7]: simplify(expr)
...
RecursionError: maximum recursion depth exceeded while calling a Python object

The infinite recursion seems to be here:

if missing or not same:
return cls(*newargs)

@oscarbenjamin oscarbenjamin reopened this Jan 25, 2022
@hanspi42
Copy link
Contributor

hanspi42 commented Dec 6, 2022

Maybe this should get a different label for people working in simplify to find it. It can also lose the integrals.transforms label since that part is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants