Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The integrand has evaluated to non-numerical values for all

1,647 views
Skip to first unread message

Kreig Hucson

unread,
Dec 2, 2007, 4:12:25 AM12/2/07
to
Hi all,

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]?

Thank You in advance,

Kreig

Jean-Marc Gulliet

unread,
Dec 3, 2007, 5:54:44 AM12/3/07
to
Kreig Hucson wrote:

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

Steve Luttrell

unread,
Dec 3, 2007, 6:06:45 AM12/3/07
to
Here is a way of approximating your integral by doing a series expansion
about a functional form that Mathematica DOES know how to integrate:

First of all define a series expansion of your f[x,y].

f20[x_,y_,n_]:=(Series[\[ExponentialE]^-(\[Epsilon]+y)^2,{\[Epsilon],0,n}]
Sin[x y])/(x y)//Normal//Simplify

Now compute the first 10 approximations to your integral. This takes a
minute or so to compute on my PC.

fapprox=Table[f2[x_,y_,i]=f20[x,y,i]/.\[Epsilon]->-1;Integrate[f2[x,y,i],{y,0,\[Infinity]}]//FullSimplify//PowerExpand,{i,10}]

You can then plot the differences between successive approximations.

Plot[Map[#[[2]]-#[[1]]&,Partition[fapprox,2,1]]//Evaluate,{x,0.01,10},PlotStyle->Table[Hue[0.8(i-1)/10],{i,1,10}]]

You don't need to go too far out in the sequence of series approximations
before these differences become quite small.

Steve Luttrell
West Malvern, UK

"Kreig Hucson" <kreig....@yahoo.com> wrote in message
news:fitstp$69s$1...@smc.vnet.net...

Steve Luttrell

unread,
Dec 5, 2007, 7:29:45 AM12/5/07
to
"Jean-Marc Gulliet" <jeanmarc...@gmail.com> wrote in message
news:fj0n9k$j2v$1...@smc.vnet.net...

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?

0 new messages