thegooglecodearchive / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

Changing limit of quadosc to -inf causes TypeError #237

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
- What steps will reproduce the problem?

This is the example taken from the documentation page on quadratures, with 
three additional lines added:

from mpmath import *
mp.dps = 15; mp.pretty = True
f = lambda x: sin(3*x)/(x**2+1)
quadosc(f, [0,inf], omega=3)
quadosc(f, [0,inf], period=2*pi/3)
quadosc(f, [0,inf], zeros=lambda n: pi*n/3)
quadosc(f, [-inf,0], omega=3)
quadosc(f, [-inf,0], period=2*pi/3)
quadosc(f, [-inf,0], zeros=lambda n: pi*n/3)

- What is the expected output? What do you see instead?

All lines run perfectly, except for the last which outputs:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/mpmath/calculus/quadrature.py", line 985, in quadosc
    return ctx.quadosc(lambda x:f(-x), [-b,-a], lambda n: zeros(-n))
  File "/usr/lib/python3/dist-packages/mpmath/calculus/quadrature.py", line 992, in quadosc
    period = 2*ctx.pi/omega
TypeError: unsupported operand type(s) for /: 'mpf' and 'function'

- What version of the product are you using? On what operating system?

Ubuntu 12.10
Python 3.3.1rc1 (default, Mar 26 2013, 18:27:31) (installed via raring universe)
mpmath 0.17 (installed via raring universe)

Original issue reported on code.google.com by photon.e...@gmail.com on 29 Mar 2013 at 3:38