Message Boards Message Boards

Optimize computing time of a numerical integration?

Posted 7 years ago

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
2 Replies

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
Posted 7 years 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
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract