Mathematica : Numerically Integrate function with undefined variables?

Click For Summary
SUMMARY

The discussion focuses on numerically integrating a complex function F[x_,y_] in Mathematica, which consists of multiple terms dependent on variables A[q] and B[q]. The user seeks an efficient method to perform this integration without expanding the entire function, which is computationally expensive. The proposed solution involves temporarily substituting variables, using CoefficientList to extract coefficients, and then applying NIntegrate to each part individually before reassembling the results. This method allows for faster computation while maintaining the integrity of the original function.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of numerical integration techniques in Mathematica
  • Knowledge of symbolic manipulation in Mathematica, specifically CoefficientList
  • Basic understanding of functions and variables in mathematical contexts
NEXT STEPS
  • Explore the use of NIntegrate in Mathematica for complex functions
  • Learn how to utilize CoefficientList for extracting coefficients in Mathematica
  • Investigate advanced numerical integration techniques in Mathematica
  • Study the implications of variable substitution in numerical computations
USEFUL FOR

Mathematica users, mathematicians, and engineers who are working with complex numerical integrations and seeking efficient computational methods.

Hepth
Science Advisor
Gold Member
Messages
458
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
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 8 ·
Replies
8
Views
4K