MathGroup Archive 2007

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

Search the Archive

Re: The integrand has evaluated to non-numerical values for all

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83955] Re: The integrand has evaluated to non-numerical values for all
  • From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
  • Date: Wed, 5 Dec 2007 07:16:00 -0500 (EST)
  • References: <fitstp$69s$1@smc.vnet.net> <fj0n9k$j2v$1@smc.vnet.net>

"Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com> wrote in message 
news:fj0n9k$j2v$1 at smc.vnet.net...
> Kreig Hucson wrote:
>
>> Being given the function:
>>
>> f[x_,y_]:= Sin[x*y]*Exp[-(y-1)^2]/(x*y) ,
>>
>> I want to integrate it with respect to y, from 0 to Infinity, and to 
>> obtain a function of x only, F[x].
>>
>> I typed the command:
>>
>> F[x_]:= Assuming[x>0, Integrate[f[x,y],{y,0,Infinity}]]
>>
>> but the integral remained unevaluated by Mathematica 6.
>>
>> After this, I typed the command:
>>
>> F[x_]:= Assuming[x>0, NIntegrate[f[x,y],{y,0,Infinity}]]
>>
>> but I received the error message: "The integrand f[x,y] has evaluated to 
>> non-numerical values for all sampling points in the region with 
>> boundaries {{Infinity,0.}}".
>> I looked at the explanations of the error message and there it was 
>> suggested to give a particular value to x and to compute the integral for 
>> that particular value. I gived one particular value and I obtained the 
>> expected result. Anyway I need to obtain an analytical expression for all 
>> x>0.
>>
>>    My question is, how can be performed the integral and to obtain the 
>> analytical function F[x]?
>
> You could change the form of the original expression to be written as
> exponentials only, then do the integration. For instance,
>
> In[1]:= expr = Sin[x*y]*Exp[-(y - 1)^2]/(x*y)
>
> Out[1]=
>     Sin[x y]
> ----------------
>          2
>  (-1 + y)
> E          (x y)
>
> In[2]:= f = TrigToExp@expr
>
> Out[2]=
>             2                       2
>    -(-1 + y)  - I x y      -(-1 + y)  + I x y
> I E                     I E
> --------------------- - ---------------------
>         2 x y                   2 x y
>
> In[3]:= F[x_] = Assuming[x > 0, Integrate[f, {y, 0, Infinity}]]
>
> Out[3]=
>        1                   3
> --------------- ((-2 - I x)  (2 I + x)
>              2
> 24 E x (4 + x )
>
>                                    5     1            2
>      HypergeometricPFQ[{1, 1}, {2, -}, -(-) (-2 I + x) ] +
>                                    2     4
>
>        2
>       x /2           3
>     (E     (-2 + I x)  (-2 I + x)
>
>                                       5     1           2
>         HypergeometricPFQ[{1, 1}, {2, -}, -(-) (2 I + x) ] -
>                                       2     4
>
>                         2
>              1 - I x + x /4                             I x
>        6 (2 E               Sqrt[Pi] (-2 I + x) Erf[1 - ---] +
>                                                          2
>
>                               2
>              2 + 1/4 (2 I + x)                             I x
>           2 E                   Sqrt[Pi] (2 I + x) Erf[1 + ---] +
>                                                             2
>
>               2
>              x /2       2               I x                I x
>           I E     (4 + x ) (Pi Erfi[1 - ---] - Pi Erfi[1 + ---] -
>                                          2                  2
>
>                                                                 2
>              2 Log[-2 - I x] + 2 Log[-2 + I x] + Log[-(-2 I + x) ] -
>
>                                      2
>                            2        x /2
>              Log[-(2 I + x) ]))) / E    )
>
> In[4]:= F[2]
>
> Out[4]=
>   1                                     5
> ----- (64 HypergeometricPFQ[{1, 1}, {2, -}, 2 I] +
> 384 E                                   2
>
>     1       2                               5
>     -- (64 E  HypergeometricPFQ[{1, 1}, {2, -}, -2 I] -
>      2                                      2
>     E
>
>                      2 - 2 I
>        6 ((4 - 4 I) E        Sqrt[Pi] Erf[1 - I] +
>
>                      2 + 2 I
>           (4 + 4 I) E        Sqrt[Pi] Erf[1 + I] +
>
>                2
>           8 I E  (I Pi + Pi Erfi[1 - I] - Pi Erfi[1 + I] -
>
>              2 Log[-2 - 2 I] + 2 Log[-2 + 2 I]))))
>
> In[5]:= % // N // Chop
>
> Out[5]= 0.453078
>
> Regards,
> -- 
> Jean-Marc
>

I tried comparing my series solution (see my parallel posting to yours) with 
your closed-form solution. When I use my most accurate series approximation 
Last[fapprox]

(1/(3628800 x))\[ExponentialE]^(-(x^2/4)) (x (-20 \[ExponentialE]^(x^2/4) 
(-37512+2252 x^2-54 x^4+x^6)+Sqrt[\[Pi]] (1149120-110880 x^2+4032 x^4-72 
x^6+x^8))+665280 \[ExponentialE]^(x^2/4) \[Pi] Erf[x/2]+10 Sqrt[\[Pi]] 
(196224-41664 x^2+2352 x^4-56 x^6+x^8) Erfi[x/2])

from my posting I get F[2]=0.636495, which disagrees with your 0.453078 
(which I can reproduce). Curious! I then tried evaluating the integral 
numerically using

With[{x = 2.},
 NIntegrate[(\[ExponentialE]^-(-1 + y)^2 Sin[x y])/(x y), {y,
   0, \[Infinity]}]]

which gives

0.63577

in close agreement with my series approximation, but in disagreement with 
your result.

I wonder what is going on here?

Steve Luttrell
West Malvern, UK 



  • Prev by Date: Re: Re: different eigenvectors
  • Next by Date: Re: Notebook programming: SlideShow: emulating bullet at-a-time
  • Previous by thread: Re: The integrand has evaluated to non-numerical values for all
  • Next by thread: Question with ListPlot