Message Boards Message Boards

Optimize computing time of a numerical integration?

GROUPS:

Hi, I have the following function to integrate:

Ftn[ Eo_?NumericQ] := NIntegrate[Evaluate[f1[Enu]*f2[Enu]* f3[Enu 0, 0]* gauss[Enu, Eo]], {Enu, 1, 30}]

where, f2[Enu] and f3[Enu] are sum of several exponential functions with exponent Enu.

This takes 40 minutes to run. Is there any other standard way to handle the numerical integration in Mathematica which take shorter running time? Thanks

POSTED BY: Amir Khan
Answer
4 months ago

We need more info to be helpful. Can you show what f1,f2,f3 look like (even a simple version), What is gauss?, Why is f3[Enu 0,0]? Is this a typo?

I suggest that you post a fully working example with AbsoluteTime[ Ftn[]].

POSTED BY: Neil Singer
Answer
4 months ago

Hi, Here gauss is a Gaussian function of Enu. All f1, f2, and f3 are sum of exponential functions all depending on Enu. [Enu,0,0] is not a typo, but you can consider this as simply f3[Enu].

I have further worked on it and found that Mathematica is not good at Functional calculations. In fact, it can evaluate the same expression if it is defined explicitly and the whole expression instead of the functional is given to it. Thanks!

POSTED BY: Amir Khan
Answer
4 months ago

Group Abstract Group Abstract