from sympy import *
t = symbols('t', real=True, positive=True) w = symbols('w', real=True) s = symbols('s') F, _, _ = laplace_transform(sinh(w*t)*cosh(w*t), t, s) assert F == w/(s**2 - 4*w**2)
AttributeError Traceback (most recent call last) <ipython-input-2-f60b9c78c600> in <module>() 2 w = symbols('w', real=True) 3 s = symbols('s') ----> 4 F, _, _ = laplace_transform(sinh(w*t)*cosh(w*t), t, s) 5 assert F == w/(s**2 - 4*w**2) 6
/home/pape/sympy/sympy/integrals/transforms.pyc in laplace_transform(f, t, s, **hints) 1117 hankel_transform, inverse_hankel_transform 1118 """ -> 1119 return LaplaceTransform(f, t, s).doit(**hints) 1120 1121
/home/pape/sympy/sympy/integrals/transforms.pyc in doit(self, **hints) 117 try: 118 return self._compute_transform(self.function, --> 119 self.function_variable, self.transform_variable, **hints) 120 except IntegralTransformError: 121 pass
/home/pape/sympy/sympy/integrals/transforms.pyc in _compute_transform(self, f, t, s, **hints) 1058 1059 def _compute_transform(self, f, t, s, **hints): -> 1060 return _laplace_transform(f, t, s, **hints) 1061 1062 def _as_integral(self, f, t, s):
/home/pape/sympy/sympy/integrals/transforms.pyc in wrapper(*args, **kwargs) 195 def wrapper(*args, **kwargs): 196 noconds = kwargs.pop('noconds', default) --> 197 res = func(*args, **kwargs) 198 if noconds: 199 return res[0]
/home/pape/sympy/sympy/integrals/transforms.pyc in _laplace_transform(f, t, s_, simplify) 956 957 if not F.has(Integral): --> 958 return simplify(F.subs(s, s), simplify), -oo, True 959 960 if not F.is_Piecewise:
/home/pape/sympy/sympy/integrals/transforms.pyc in _simplify(expr, doit) 170 from sympy import powdenest, piecewise_fold 171 if doit: --> 172 return simplify(powdenest(piecewise_fold(expr), polar=True)) 173 return expr 174
/home/pape/sympy/sympy/simplify/simplify.pyc in simplify(expr, ratio, measure, fu) 3674 expr = bottom_up(expr, lambda w: w.normal()) 3675 expr = Mul(*powsimp(expr).as_content_primitive()) -> 3676 _e = cancel(expr) 3677 expr1 = shorter(_e, _mexpand(_e).cancel()) # issue 3730 3678 expr2 = shorter(together(expr, deep=True), together(expr1, deep=True))
/home/pape/sympy/sympy/polys/polytools.pyc in cancel(f, *gens, **args) 6070 continue 6071 try: -> 6072 reps.append((e, cancel(e))) 6073 pot.skip() # this was handled successfully 6074 except NotImplementedError:
/home/pape/sympy/sympy/polys/polytools.pyc in cancel(f, *gens, **args) 6070 continue 6071 try: -> 6072 reps.append((e, cancel(e))) 6073 pot.skip() # this was handled successfully 6074 except NotImplementedError:
/home/pape/sympy/sympy/polys/polytools.pyc in cancel(f, *gens, **args) 6037 return f 6038 f = factor_terms(f, radical=True) -> 6039 p, q = f.as_numer_denom() 6040 6041 elif len(f) == 2:
AttributeError: 'And' object has no attribute 'as_numer_denom'
Comment #1
Posted on Oct 27, 2013 by Grumpy PandaA slightly different one: laplace_transform(sinh(t)*cosh(t), t, s)
raises same error with different message: /home/pape/sympy/sympy/integrals/transforms.pyc in laplace_transform(f, t, s, **hints) 1117 hankel_transform, inverse_hankel_transform 1118 """ -> 1119 return LaplaceTransform(f, t, s).doit(**hints) 1120 1121
/home/pape/sympy/sympy/integrals/transforms.pyc in doit(self, **hints) 117 try: 118 return self._compute_transform(self.function, --> 119 self.function_variable, self.transform_variable, **hints) 120 except IntegralTransformError: 121 pass
/home/pape/sympy/sympy/integrals/transforms.pyc in _compute_transform(self, f, t, s, **hints) 1058 1059 def _compute_transform(self, f, t, s, **hints): -> 1060 return _laplace_transform(f, t, s, **hints) 1061 1062 def _as_integral(self, f, t, s):
/home/pape/sympy/sympy/integrals/transforms.pyc in wrapper(*args, **kwargs) 195 def wrapper(*args, **kwargs): 196 noconds = kwargs.pop('noconds', default) --> 197 res = func(*args, **kwargs) 198 if noconds: 199 return res[0]
/home/pape/sympy/sympy/integrals/transforms.pyc in _laplace_transform(f, t, s_, simplify) 956 957 if not F.has(Integral): --> 958 return simplify(F.subs(s, s), simplify), -oo, True 959 960 if not F.is_Piecewise:
/home/pape/sympy/sympy/integrals/transforms.pyc in _simplify(expr, doit) 170 from sympy import powdenest, piecewise_fold 171 if doit: --> 172 return simplify(powdenest(piecewise_fold(expr), polar=True)) 173 return expr 174
/home/pape/sympy/sympy/simplify/simplify.pyc in simplify(expr, ratio, measure, fu) 3674 expr = bottom_up(expr, lambda w: w.normal()) 3675 expr = Mul(*powsimp(expr).as_content_primitive()) -> 3676 _e = cancel(expr) 3677 expr1 = shorter(_e, _mexpand(_e).cancel()) # issue 3730 3678 expr2 = shorter(together(expr, deep=True), together(expr1, deep=True))
/home/pape/sympy/sympy/polys/polytools.pyc in cancel(f, *gens, **args) 6070 continue 6071 try: -> 6072 reps.append((e, cancel(e))) 6073 pot.skip() # this was handled successfully 6074 except NotImplementedError:
/home/pape/sympy/sympy/polys/polytools.pyc in cancel(f, *gens, **args) 6037 return f 6038 f = factor_terms(f, radical=True) -> 6039 p, q = f.as_numer_denom() 6040 6041 elif len(f) == 2:
AttributeError: 'Or' object has no attribute 'as_numer_denom'
Comment #2
Posted on Oct 28, 2013 by Happy GiraffeI've seen this, too.
Comment #3
Posted on Nov 7, 2013 by Happy ElephantInteresting. I worked around this for the new S.true and S.false at https://github.com/sympy/sympy/pull/2560, but apparently it can happen for any boolean expression.
One could work around this in the same way, though really, we should investigate why cancel() gets called on a non-Expr in the first place.
Comment #4
Posted on Nov 7, 2013 by Happy GiraffeAfter https://github.com/sympy/sympy/pull/2565 these transforms now return unevaluated LaplaceTransform objects.
Comment #5
Posted on Mar 5, 2014 by Happy ElephantWe have moved issues to GitHub https://github.com/sympy/sympy/issues.
Comment #6
Posted on Apr 6, 2014 by Happy RabbitMigrated to http://github.com/sympy/sympy/issues/7173
Status: Valid
Labels:
Type-Defect
Priority-Medium
Polynomial
Simplify
Integration
Restrict-AddIssueComment-Commit