[Tutor] fixed quad

Msd De mmssdd1920 at gmail.com
Sat Jul 24 02:31:52 EDT 2021


 I have nested integrals and need to use a fixed quad to carry out the
integration
Below is my code. Not sure of whether use of lambda function is appropriate
need help with regards to use of lambda function.
Thank you

LB=0.0
UB=etatip
K001_Intg=[None]*64;K0d1_Intg=[None]*64;Kd01_Intg=[None]*64;Kdd1_Intg=[None]*64
def kfac_11(eta,Ex):
         distGen=array_defl[i]
         a=2*FCON*abs(EL-Ex)
         ...............
          .............
           ............
         K001_Intg=F0_xp*Fd_xp*f_xp*etaTerm/W
         K0d1_Intg=Kdd_0*F0_xp**2*f_xp*etaTerm/W
         Kd01_Intg=K00_0*Fd_xp**2*f_xp*etaTerm/W
         Kdd1_Intg=F0_xp*Fd_xp*f_xp*etaTerm/W
         return [K001_Intg,K0d1_Intg,Kd01_Intg,Kdd1_Intg];

DFF_11=[]
*def DEx11(Ex):  *
       distGen=array_defl[i]
       global xp
       xp=(array_xefl[i,])
       arr_KFact=[]
       *K_Fact=integrate.fixed_quad(kfac_11, LB, UB, args=(Ex, ), n=64)  *
        .........
        .........
        .......
       DEx_11=(ak2/ak1)*TP_1*DFF_11*CONST
       return DEx_11

JRuss11={}
array_JRuss11=np.zeros(64)

*for i in range(64): *
     *JRuss11[i]=integrate.fixed_quad(lambda Ex: DEx11(Ex),ELOW, EHIGH,
n=64)*
     array_JRuss11[int(i)]=(JRuss11[i][0])

IntgRusscurr11=[]
Russcurrent11=[]
arr_Russcurrent11=np.zeros(64)
*def currRuss11(xiRuss11): *
         IntgRusscurr11=array_JRuss11*np.sqrt(xiRuss11**2-etatip**2)*CCONST
     *    return *IntgRusscurr11


More information about the Tutor mailing list