Numerical integration with C ++ on a given grid with fixed constant sampling

I have the following problem:

My C ++ code can calculate two functions

f1 (I1, I2, I3, I4)

2 (J1, J2)

for each set {i1, i2, i3, i4} I get some value of f1 and for each set of {j1, j2} we get some value of f2.

the sets {i1, i2, i3, i4} and {j1, j2} are defined on the FIXED grid with some constant sampling step "h".

I need to calculate in mathematical language the integral F3 (x1, x3) = Integral [f1 (x1, x2, x3, x4) * f2 (x3, x4) dx3 dx4]

Simple summation is not good enough, since f2 has many jumps.

Is there a C ++ library that can perform such an integration? Or some algorithm that is easy to implement (I'm not very good in C ++)

many thanks

+5
4

(http://en.wikipedia.org/wiki/Simpson%27s_rule). , , f2 , h . , , - h . :

1. Start with a global common h
2. Divide the space into smaller subspaces
3. Calculate integral for each subspace
4. Recalculate integral for each subspace using step size h/2
5. For only subspaces where difference between integrals (h and h/2) is substantial repeat the above mentioned steps (From step 3)
+1

. , , . , .

, , , . - , . - .

, , . -.

+1

You mentioned that you know jumping on f2, can you highlight f2 in f2 = f2a + f2b, where; f2a is a smooth function on which the usual methods of numerical integration are sufficient, and f2b is a very simple function with jumps, which you can calculate the region analytically, since it is simple. Then you can simply add values, since integration is a linear operation. I think it all depends on what you know about f2.

0
source

All Articles