简体   繁体   中英

How to use scipy.integrate tplquad for a function that requires more than three (3) arguments

I'm building a python function that requires 6 (six) arguments, but returns a function of three variables. This last return I want to use in the scipy.integrate tplquad method.

Let 'Function1' be the first function said, so I define:

 def Function1(z,y,x,e,N,a):

    {code}

    return Function2

where Function2=f(z,y,x)

Then I need to use Function2 in another python function where I'm willing to use tplquad integration method, which it's said it requires "A Python function or method of at least three variables in the order (z, y, x).".

So my question is how can I implement (if it is possible) a function with more than 3 arguments in the tplquad method, understanding that the three first arguments would be 'z,y,x'.

Try tplquad(f,..., args=(e, N, a)) . Alternatively, pass in a lambda: tplquad(lambda z, y, x: Function1(z,y,x, e, N, a), ...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM