Skip to content

Issue with zeros in quadosc #652

Description

@cepessh

The code

import mpmath

mpmath.quadosc(
    mpmath.airyai,
    [-mpmath.inf, 0],
    zeros=lambda n: -mpmath.airyaizero(-n),
)

yields

[/usr/local/lib/python3.8/dist-packages/mpmath/calculus/quadrature.py](https://localhost:8080/#) in quadosc(ctx, f, interval, omega, period, zeros)
    992         if not zeros:
    993             if omega:
--> 994                 period = 2*ctx.pi/omega
    995             zeros = lambda n: n*period/2
    996         #for n in range(1,10):

TypeError: unsupported operand type(s) for /: 'mpf' and 'function'

I think that zeros are regarded as a positional argument in the line 987 of quadrature.py

        if a == ctx.ninf:
            if zeros:
                return ctx.quadosc(lambda x:f(-x), [-b,-a], lambda n: zeros(-n))

and are messed with omega.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions