2

Is there a possibility to include more than 1 argument in a quadpy integration?

def function(x,a):
    return a*x**2

scheme = quadpy.line_segment.gauss_legendre(10)
scheme.integrate(function, [0,1])

# function() missing 1 required positional argument

Similar to scipy integration:

a=2

scheme.integrate(function, [0,1], args=(a))
1

1 Answer 1

2

You can already do that:

import quadpy


def function(x, a):
    return a * x ** 2


scheme = quadpy.c1.gauss_legendre(10)

a = 10
out = scheme.integrate(lambda x: function(x, a), [0, 1])
print(out)
3.3333333333333326
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.