Reputation: 542
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?
Upvotes: 1
Views: 112
Reputation: 798556
You want to use a lambda to call the function appropriately, similar to so:
integrate.quad(lambda x: 1/somefunc(x), lowerbound, upperbound)
Upvotes: 1