简体   繁体   English

如何将scipy.integrate tplquad用于需要三(3)个以上自变量的函数

[英]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. 我正在构建一个需要6个(六个)参数的python函数,但是返回一个包含三个变量的函数。 This last return I want to use in the scipy.integrate tplquad method. 我要在scipy.integrate tplquad方法中使用的最后一个返回值。

Let 'Function1' be the first function said, so I define: 让“ Function1”成为第一个说的函数,因此我定义:

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

    {code}

    return Function2

where Function2=f(z,y,x) 其中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).". 然后,我需要在另一个愿意使用tplquad集成方法的python函数中使用Function2,据说它需要“一个Python函数或至少包含三个变量(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'. 所以我的问题是,如何在tplquad方法中实现(如果可能的话)具有3个以上参数的函数,同时要理解三个第一个参数为'z,y,x'。

Try tplquad(f,..., args=(e, N, a)) . 尝试tplquad(f,..., args=(e, N, a)) Alternatively, pass in a lambda: tplquad(lambda z, y, x: Function1(z,y,x, e, N, a), ...) 或者,传入一个lambda: tplquad(lambda z, y, x: Function1(z,y,x, e, N, a), ...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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