1

I have the following existing code:

integrate.quad(somefunc, lowerbound, upperbound)

However I want to change this to

integrate.quad(1/somefunc, lowerbound, upperbound)

but I get operand errors. Is there a way I can do this without changing somefunc?

1 Answer 1

1

You want to use a lambda to call the function appropriately, similar to so:

integrate.quad(lambda x: 1/somefunc(x), lowerbound, upperbound)
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.