laplace_transform hypergeometric?

22 views
Skip to first unread message

Raymond Rogers

unread,
Apr 13, 2018, 12:55:12 PM4/13/18
to sage-s...@googlegroups.com
Is the Laplace transform of hypergeometric functions implemented?  If
not can I have a pointer to how to implement it?
Here is an example under notebook(); jupyter throws the same error.
"TypeError: 'Integer' object is not iterable" , I tried various
alterations of the parameters; to no avail.
Since the error seems irrelevant, should I try to look at the source
(since it seems to try)?

Ray

from sympy import *
from sage.calculus import *
from sympy.integrals import laplace_transform
from sympy.abc import t, s
#from sympy.holonomic.holonomic import *
#from sympy.holonomic import DifferentialOperators,  from_meijerg,
from_hyper
#from sympy.abc import x
from sympy import ZZ
#R, D = DifferentialOperators(ZZ.old_poly_ring(x), 'D')
#HolonomicFunction(D**2 + 1, x, 0, [0, 1])
#HolonomicFunction((1) + (1)*D**2, x, 0, [0, 1])

x, y,b,a= symbols('x y b a  ')

k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)
init_printing(use_unicode=True)

--- code
eq= hypergeometric([1,2-a], [2], t)
print(eq)
print("----")
eq3l=laplace_transform(eq,t,s)
print("----")
eq3l

---
response from sagemath
---
hypergeometric((1, -a + 2), (2,), t)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_23.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
-*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("ZXFhPSBoeXBlcmdlb21ldHJpYyhbMSwyLWFdLCBbMl0sIHQpCnByaW50KGVxYSkKZXEzbD1sYXBsYWNlX3RyYW5zZm9ybShlcWEsdCxzLHBsYW5lPU5vbmUpCmVxM2w="),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/tmp/tmpO9ZqR1/___code___.py", line 5, in <module>
    eq3l=laplace_transform(eqa,t,s,plane=None)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/integrals/transforms.py",
line 1122, in laplace_transform
    return LaplaceTransform(f, t, s).doit(**hints)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/core/cache.py",
line 95, in wrapper
    retval = func(*args, **kwargs)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/core/function.py",
line 427, in __new__
    result = super(Function, cls).__new__(cls, *args, **options)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/core/cache.py",
line 95, in wrapper
    retval = func(*args, **kwargs)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/core/function.py",
line 240, in __new__
    args = list(map(sympify, args))
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/core/sympify.py",
line 291, in sympify
    return a._sympy_()
  File "sage/symbolic/expression.pyx", line 1445, in
sage.symbolic.expression.Expression._sympy_
(build/cythonized/sage/symbolic/expression.cpp:11968)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.py",
line 226, in __call__
    return self.composition(ex, operator)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.py",
line 794, in composition
    return f_sympy(*sympy.sympify(g, evaluate=False))
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/functions/special/hyper.py",
line 182, in __new__
    return Function.__new__(cls, _prep_tuple(ap), _prep_tuple(bq), z)
  File
"/media/rrogers/Data/opt/SageMath/local/lib/python2.7/site-packages/sympy/functions/special/hyper.py",
line 44, in _prep_tuple
    return TupleArg(*[unpolarify(x) for x in v])
TypeError: 'Integer' object is not iterable

Ralf Stephan

unread,
Apr 13, 2018, 1:30:33 PM4/13/18
to sage-support
The transform is implemented via calling of SymPy but apparently something went wrong in the conversion to SymPy. I cannot say more as I'm not at my box but you can try to use SymPy directly as a workaround.

Regards,

Ralf Stephan

unread,
Apr 14, 2018, 1:51:31 AM4/14/18
to sage-support
I confirm conversion of hypergeometric 2F1 to SymPy is broken---but 2F2 is not so the workaround would be to give an additional 1 argument in the second slot. 
Reply all
Reply to author
Forward
0 new messages