my problem is that I have a rather large function which I'm trying to plot, which looks something like this:


This works fine, but when I try to change it to LogLinearPlot, I get a lot of error messages. Any idea what I should do?

Thanks, Dan


marked as duplicate by bbgodfrey, Mr.Wizard Feb 13 '15 at 13:47

This question was marked as an exact duplicate of an existing question.

  • $\begingroup$ I have trouble guessing what error messages you get :D Joking aside you are trying to numerically integrate a function of two variables over the first one. That's not possible - you have to supply NIntegrate with values for every parameter or you will end up with a lot of error messages. $\endgroup$ – Sektor Feb 13 '15 at 11:57
  • 2
    $\begingroup$ @Sektor The y values comes from Plot, except when it attempts symbolic evaluation. $\endgroup$ – Mr.Wizard Feb 13 '15 at 12:28

This should probably be closed as a duplicate of one of the the many NumericQ questions on this site.

The problem is that LogLinearPlot attempts a symbolic evaluation, meaning that y is not given a value, and NIntegrate doesn't like this! You can use a wrapper function to prevent non-numeric y values being passed its way:

f[x_, y_] := x + y^2

fint[y_?NumericQ] :=
 NIntegrate[f[x, y], {x, 0, 1.2, 3}, Method -> "LocalAdaptive"]

LogLinearPlot[fint[y], {y, 1, 3}]

enter image description here


Not the answer you're looking for? Browse other questions tagged or ask your own question.