Mathematica Mathematica : Numerically Integrate function with undefined variables?

Click For Summary
The discussion centers on the challenge of numerically integrating a complex function F[x, y] over two variables, where each term is separable and involves undefined variables A[q] and B[q]. The user seeks a method to avoid the lengthy algebraic integration process, which takes several minutes, by leveraging the faster numerical integration capabilities of NIntegrate. Suggestions include temporarily substituting the undefined variables with placeholders, using CoefficientList to extract and integrate the separable components individually, and then reassembling the results. The goal is to achieve a final expression that retains the original variable dependencies while speeding up the integration process. This approach aims to streamline the integration of large functions efficiently.
Hepth
Science Advisor
Gold Member
Messages
457
Reaction score
40
I have a LARGE function that I must integrate over 2 variables, {x,y} both from 0 to 1.

The Function looks like :

F[x_,y_] = A[q] G[x,y] + B[q] G2[x,y] + (...)

Where (...) MAY be 100's of terms long, if not thousands. But the fact is each term is separable, in SOME way to a function of x and y (and no other units or unknown variables).

Each G function is quite complicated as well, and so far takes over 3 minutes each to integrate algebraically, though can be numerically integrated in under a second or two. They're all well behaved in the integration region.

Is there a way, other than expand F, and dividing out A[q] etc for each, doing the NIntegrate, then multiplying it again, to numerically integrate this equation so it ends up being:

result = (0.14325) A[q] + (-4.5602134) B[q] + (...)

Can I tell NIntegrate to integrate around variables?

I know something like NIntegrate[ a x^2,{x,0,1}] will throw an error due to an undefined "a" inserted.
 
Physics news on Phys.org

Similar threads

  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K