0

I am doing some program where I must calculate some numerical integral (the involved function is quite complicated to be solved analytically). The function to be integrated have some parameters which are obtained from some random generation.

For example,

NIntegrate[f[a,b,c,x]/.RndArray,{x,0,Infinity}]

where RndArray is some array with replacement rules of the kind

{{a->3,b->4,c->9},{a->1,b->2,c->8},...}

So what I do is to get an array of the kind

Integrals = Array[NIntegrate[f[a,b,c,x]/.RndArray[[#]],{x,0,Infinity}]&,Length[RndArray]];

The point is that sometimes Mathematica has some problems overflow problems when integrating. Then, all the output in Integrals is missing.

My question is, is there anyway to ignore this and show all the other results?

pablo
  • 723
  • 1
  • 9
  • 17
  • What happens if you instead do: Table[With[{F = f[a, b, c, x] /. rules}, Integrate[F, {x, 0, Infinity}]], {rules, RndArray}]? – rm -rf Jun 28 '13 at 08:19
  • Sorry, the rules over there are not the same as RndArray? – pablo Jun 28 '13 at 08:24
  • They are. Please see the 5th form for Table here. – rm -rf Jun 28 '13 at 08:25
  • Thanks, I could solve my problem. The point is that (as I have changed above) I was saving my information in the Integrals variable, which information was lost in case there was some overflow. I didn't see the output due to the ;. However, this is what I would expect: all the numbers calculated plus some overflow where errors occurred.

    However, when using Table, this is no longer a problem, then Integrals keeps all the numbers and the overflow, which I can remove by hand to further use this variable through the program.

    Thansk a lot!

    – pablo Jun 28 '13 at 08:42
  • 2
    Take a look at a closely related question: Max of a table/list with indeterminate values, you'll find there good hints. – Artes Jun 28 '13 at 09:27
  • Thanks, quite useful, I think this will definitely solve my problem! – pablo Jun 28 '13 at 09:33
  • This question is too narrow and specialized to the local situation of the person who asked it. – m_goldberg Jun 28 '13 at 13:35
  • @pablo Consider answering your own question (if you use another answer, make a reference to it). – Artes Jun 28 '13 at 15:13
  • Ok, sorry. Finally the problem was solved using Table instead of Array, which keeps the problematic results in the vector. An alternative is not to add the ; at the end, so the output with error is produced and can be further used.

    However, the problematic parts must be removed by hand, since they are not labelled by Indeterminate rather than NIntegrate[...]. However, being rare such cases they don't represent a huge problem

    – pablo Jun 29 '13 at 11:51

0 Answers0