[Tutor] nested integral

Alan Gauld alan.gauld at yahoo.co.uk
Tue May 11 08:38:01 EDT 2021


On 11/05/2021 12:11, Msd De wrote:
> NameError: name 'fixed_quad' is not defined

Always post the full error message, it contains a lot
of useful data.

> I am currently writing a program that involves nested integrals.
> Every source that I have seen to do this either involves lambda or creating
> a definition that outputs an equation.
> So, my question is, is there any way to integrate it without doing that?

My question is: why would you want to?
That's like asking if it's possible to square a number without using
multiplication (yes, via repeated addition - but why?!) If the option
is there for a simpler solution then why not use it?

> Here's part of my code:

Please always post to the list using plain text. Otherwise
the mail system strips out spacing and your code becomes
virtually impossible to read/debug.

> 
> 
> def DEx11(Ex):  # 64 values of array_defl
> distGen=array_defl[i]
> return fixed_quad(kfac_11, LB, UB, n=64, args=(Ex))

This looks like the source of your error. You forgot to
prefix it with the module name.

Compare with:

> # JRuss11[k]=integrate.fixed_quad(DEx11, ELOW11Russ, EHIGH11Russ, n=64)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list