Message Boards Message Boards

0
|
12842 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

LogLinearPlot throws infinite expression 1/0. encountered

Posted 10 years ago

I have:

LogLinearPlot[ f1[bg] - f2[bg], {bg, 100, 10000000}]

and I get:

Power::infy: Infinite expression 1/0. encountered. >>

Power::infy: Infinite expression 1/Sqrt[0.] encountered. >>

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered. >>

Power::infy: Infinite expression 1/0.^2 encountered. >>

General::stop: Further output of Power::infy will be suppressed during this calculation. >>

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered. >>

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered. >>

General::stop: Further output of Infinity::indet will be suppressed during this calculation. >>

If I use simple Plot, it does not occur. I have been trying to find the error in my code, but Mathematica does not give a clue where to look for it (the supporting functions called from those above take about 500 lines of code). Also, it is worth noting that Mathematica plots the graph in the end. I tried standard debugging inserting prints to the most likely places where zero division could happen but I could never catch the error. It is also interesting that if I plot a wider range ({bg, 1, 10000000}) the error never occurs.

How can I find out where the problem is or what is going on (at this moment I am starting to thing that the problem is LogLinearPlot itself)?

Thank you.

POSTED BY: Leos Pohl
3 Replies

Attaching a notebook (.nb) file with all the code needed to duplicate the problem would help potential helpers.

POSTED BY: Bruce Miller
Posted 10 years ago

You obviously have no definition for f1[] and f2[].

POSTED BY: Simon Tyran
Posted 10 years ago

Do you have any zeros or near-zero values in your dataset (bg) or as a result of f1[bg] or f2[bg]? If so, you could try dropping those, or adding 1 before doing your other operations. Hard to determine without knowing the range of values in your data.

POSTED BY: Caitlin Ramsey
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