MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NIntegrate and Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63871] Re: NIntegrate and Plot
  • From: Peter Pein <petsie at dordos.net>
  • Date: Fri, 20 Jan 2006 04:32:24 -0500 (EST)
  • References: <dqn7v6$l9j$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Peter Rolnick schrieb:
> Hello. I have a 3D function that I am integrating numerically, and it has a
> parameter, q. As far as I can tell, the integrand is never infinite or
> complex. When I use NIntegrate for a particular value of q, it does the
> numerical integral and gives me a reasonable value for the result (for q = 0
> it gives me the expected analytic value). I can do this for many values of
> q, and it seems to work just fine.
> 
> However... when I try to Plot the numerical integral as a function of q,
> though it does actually give me a reasonable plot, it also gives me this
> message:
> 
> It gives the message repeatedly, always at the same values of k, X, and
> gamma (the variables of integration). There is nothing weird or singular at
> those points, and if I ask the numerical integral to skip any or all of
> those points, it gives the same message at some slightly different points.
> This makes me think that the problem does not have to do with those
> particular points. (It does this weird behavior even if I just use the Real
> part of the integrand, so it can't be that the value of the integrand is
> complex anywhere.)
> 
> So my question is, why does Mathematica let me do NIntegrate for a single
> value of q, but get upset if I try to Plot the numerical integral over a
> range of values of q (even though it actually ends up doing what I asked it
> to do)?
> 
> I'm suspecting this is some simple but subtle quality of Mathematica that
> has to do with using the function NIntegrate inside the function Plot.
> 
> Thanks very much.
> 
> Peter Rolnick
> 
> Peter Rolnick,  <mailto:prolnick at truman.edu> prolnick at truman.edu 
> 
> 216 N New St, Kirksville MO 63501, 660-665-2703
> 
>  <http://www2.truman.edu/~prolnick> http://www2.truman.edu/~prolnick
> 
> 
> 
Just a guess:

did you try 
plotfunc[q_?NumericQ]:=NIntegrate[f[k,X,gamma,q],{k,k0,k1},{X,X0,X1},{gamma,g0,g1}];
Plot[plotfunc[q],{q,q0,q1}]
?

Peter


  • Prev by Date: Re: Beginner--Exporting formatted text files
  • Next by Date: Re: Problem plotting high-order Laguerre polynomials
  • Previous by thread: Re: NIntegrate and Plot
  • Next by thread: Re: NIntegrate and Plot