Jump to content

Numeric integration (Please help)


Recommended Posts

Hi all,

 

I am trying to do re produce  the python dblquad fanctrion in labview with no luck. I just cannot get my head around how to generate the 2d array for this function. the python is running smoothly and gives me accurate valuse for What I am generating:

           while i<nop:
            xi=x[i]
            wz=beamwaist*np.sqrt(1+xi**2)
            q0=T*delta_phi0/(2*np.pi)       # n=2, q0= (2-1)*gamma_2*Ii*Leff
            q=q0/(1+x[i]**2)
            def f(r,t):
                I_input=np.exp(-t**2)/(1+xi**2)*np.exp(-2*r**2/((beamwaist**2)*(1+xi**2)))
                f=2*np.pi*I_input*r                
                return f
            quad0,err=dblquad(f,0,3*wz,0,4)            
               

This is as far as I have gotten, but all the rsults are incorrect.

I have devided the integrand into wo parts f(t): np.exp(-t**2)/(1+xi**2) and f(r): r*(np.exp(-2*r**2/((beamwaist**2)*(1+xi**2)))) and a vi for generation the r[i] and t[i] as in pic the rst of the inputs ar generated and feed into the VIs. I tried to use quadrature.vi as well how ever that same problem exists since I have to prepare tha vi to generate the 2d array of (f(x), f(y)) or an string of integrand which present the same issue.

Please, I appreciate any help or suggestions.

image.png.2864ccfa2161cd5aa6177ef298590c70.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.