Re: Need integration help!
- To: mathgroup@smc.vnet.net
- Subject: [mg10765] Re: [mg10735] Need integration help!
- From: jpk@max.mpae.gwdg.de
- Date: Thu, 5 Feb 1998 00:58:15 -0500
Hi,
the Set[] function evaluates its right hand side and so Your definition
F[e_]=NIntegrateInterpolatingFunction[T[w]/(w^2 - e^2), {w, 1, e-1}]
fails because e is not bounded to a value the solution is simple
F[e_]:=NIntegrateInterpolatingFunction[T[w]/(w^2 - e^2), {w, 1, e-1}]
use SetDelayed[]. Additional I recommend to restikt e to numerical
values with
F[e_?NumericQ]:=NIntegrateInterpolatingFunction[T[w]/(w^2 - e^2), {w, 1,
e-1}]
Hope that helps.
Jens
> I'm evaluating Mathematica on a friend's machine, trying to see if I can
> do this calc so I can dump another math engine I own. I have only
> Wolfram's book and my wits.
>
> I am calculating an integral that looks like this:
>
> 4
> /
> | T(w)/(w^2 - 5^2) dw
> /
> 2
>
>
> It happens that T(w) is a previously defined, debugged, and well-behaved
> InterpolatingFunction over the range of integration. I am using
> NIntegrateInterpolatingFunction. The exact Mathematica coding I use is:
>
> NIntegrateInterpolatingFunction[T[w]/(w^2 - 5^2), {w, 1, 4}]
>
> This calculates a number. FYI, the result happens to be 0.0111 for my
> T[w]. All's well so far. But, as a lead-in to my punchline question, I
> am also defining a function F thusly:
>
> F[e_]=NIntegrateInterpolatingFunction[T[w]/(w^2 - e^2), {w, 1, 4}]
>
> When I define this, I get a message 'Integrand is not numerical at w =
> 2.' I'm not sure what this means. I thought it was just a warning
> reminder that the integrand could be singular if I wasn't careful, but
> I didn't worry about it since I am making sure my value of 'e' is
> always well outside of the integrating limits (in this case, e=5). But
> now I realize this warning probably is serious and that I need to be
> more careful because
>
> F[5] yields 0.0027, NOT the previous 0.0111 !!!!!
>
> Can anyone explain the nuances of this subtlety? What is the deep
> meaning of the above warning and how can it mess me up? Am I doing
> something improperly or dumb?
>
>
> Now, if that's not enough, *here* is the -punchline- question:
>
> What I *really* need to do for my application is define
>
> F[e_]=NIntegrateInterpolatingFunction[T[w]/(w^2 - e^2), {w, 1, e-1}]
>
> so I can generate a list of values F[5], F[6], F[whatever]. But
> Mathematica does not like the upper limit to be anything other than a
> number, apparently. Regardless of my earlier question, how can I define
> a function whose arguments may include an integral's upper limit?
>
>
> Help! I'd like to switch to Mathematica. There's gotta be a way to do
> this.
>
>
> TIA
>
>
> Stefan Jeglinski
>