This is nuts: Block[{u = 1}, g3[u]] and Block[{u = 0}, g3[u]] executes but NIntegrate[g3[u], {u, 0, Infinity}] doesn't execute

• To: mathgroup at smc.vnet.net
• Subject: [mg124195] This is nuts: Block[{u = 1}, g3[u]] and Block[{u = 0}, g3[u]] executes but NIntegrate[g3[u], {u, 0, Infinity}] doesn't execute
• From: Shravan <shravan0361 at gmail.com>
• Date: Thu, 12 Jan 2012 04:21:24 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```Hello All,
This program is not as daunting as it appears to be. I am
struggling with an issue related to NIntegration. I think the problem
is related to syntax but I am not sure. I am having tough time
executing the following commands in mathematica.

z1 = NIntegrate[g3[u], {u, 0, Infinity}]

z2 = Block[{u = 0},g3[u]]

z3 = Block[{u=1},g3[u]]

me how to solve this?

g3[u_] := Product[(Sum[(f1[u, k, n] + f2[u, k, n])*(2/Pi), {n, 1,
62}])*(1/(2*63)), {k, 2, 10}]

f1[u_, k_, n_] := NIntegrate[g1[u, k, n, z], {z, 0, Pi/2}]

f2[u_, k_, n_] := NIntegrate[g2[u, k, n, z], {z, 0, Pi/2}]

g1[u_, k_, n_, z_] := (Sinc[(y[[k]][[n + 1]] - y[[k]][[n +
1]])*u*(Cos[z]/(2*Pi*63))])*(Cos[(y[[k]][[n + 1]] + y[[k]][[n +
1]])*u*(Cos[z]/(2*63))])

g2[u_, k_, n_, z_] := (Sinc[(y[[k]][[63 - n + 1]] - y[[k]][[63 -
n]])*u*(Cos[z]/(2*Pi*63))])*(Cos[(y[[k]][[63 - n + 1]] +
y[[k]][[63 - n]])*u*(Cos[z]/(2*63))])

'y' is a 2D list given as follows

{{0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, {0.516129, 1.03226,
0.516129, 0.516129, 0.516129, 0.516129, 0.483871, 0.451613,
0.451613, 0.451613, 0.451613, 0.419355, 0.387097, 0.354839,
0.354839, 0.354839, 0.322581, 0.322581, 0.290323, 0.290323,
0.322581, 0.258065, 0.193548, 0.129032, 0.0967742, 0.0967742,
0.0645161, 0.0322581, 0.0322581, 0.0967742, 0.0967742, 0., 0.,
0., -0.0967742, -0.0967742, -0.0322581, -0.0322581, -0.0645161, \
-0.0967742, -0.0967742, -0.129032, -0.193548, -0.258065, -0.322581, \
-0.290323, -0.290323, -0.322581, -0.322581, -0.354839, -0.354839, \
-0.354839, -0.387097, -0.419355, -0.451613, -0.451613, -0.451613, \
-0.451613, -0.483871, -0.516129, -0.516129, -0.516129, -0.516129}, \
{0.516129, 0.516129, 0.516129, 0.516129, 0.516129, 0.483871, 0.419355,
0.387097, 0.387097, 0.387097, 0.354839, 0.354839, 0.354839,
0.322581, 0.322581, 0.290323, 0.258065, 0.16129, 0.129032, 0.16129,
0.129032, 0.0645161, 0.0645161, 0.16129, 0.129032, 0.0322581,
0.0322581, 0., -0.0645161, -0.0645161, -0.0322581, 0.,
0., -0.0322581, -0.0645161, -0.129032, -0.193548, -0.225806, \
-0.290323, -0.258065, -0.225806, -0.258065, -0.258065, -0.322581, \
-0.354839, -0.322581, -0.354839, -0.387097, -0.419355, -0.451613, \
-0.451613, -0.419355, -0.419355, -0.483871, -0.516129, -0.516129, \
-0.516129, -1., -0.483871, -0.516129, -0.516129, -0.516129, \
-0.516129}, {0.516129, 0.516129, 1.03226, 0.516129, 0.516129,
0.516129, 0.516129, 0.483871, 0.451613, 0.451613, 0.451613,
0.451613, 0.419355, 0.387097, 0.354839, 0.354839, 0.354839,
0.322581, 0.322581, 0.290323, 0.290323, 0.322581, 0.258065,
0.193548, 0.129032, 0.0967742, 0.0967742, 0.0645161, 0.0322581,
0.0322581, 0.0967742, 0.0967742, 0., 0.,
0., -0.0967742, -0.0967742, -0.0322581, -0.0322581, -0.0645161, \
-0.0967742, -0.0967742, -0.129032, -0.193548, -0.258065, -0.322581, \
-0.290323, -0.290323, -0.322581, -0.322581, -0.354839, -0.354839, \
-0.354839, -0.387097, -0.419355, -0.451613, -0.451613, -0.451613, \
-0.451613, -0.483871, -0.516129, -0.516129, -0.516129}, {0.516129,
0.516129, 0.516129, 0.516129, 0.516129, 0.483871, 0.451613,
0.419355, 0.387097, 0.387097, 0.354839, 0.322581, 0.258065,
0.225806, 0.193548, 0.16129, 0.16129, 0.16129, 0.225806, 0.225806,
0.16129, 0.129032, 0.0645161, 0.0322581, 0.0322581, 0.0322581,
0.0645161, 0.0322581, 0.,
0., -0.0967742, -0.16129, -0.129032, -0.16129, -0.16129, -0.193548,
\
-0.258065, -0.225806, -0.258065, -0.290323, -0.225806, -0.225806, \
-0.258065, -0.322581, -0.419355, -0.419355, -0.354839, -0.354839, \
-0.419355, -0.483871, -0.516129, -0.483871, -0.903226, -0.387097, \
-0.483871, -0.516129, -0.516129, -0.483871, -0.451613, -0.483871, \
-0.516129, -0.516129, -0.516129}, {0.516129, 0.516129, 0.516129,
0.516129, 0.516129, 0.516129, 0.483871, 0.419355, 0.387097,
0.387097, 0.387097, 0.354839, 0.354839, 0.354839, 0.322581,
0.322581, 0.290323, 0.258065, 0.16129, 0.129032, 0.16129, 0.129032,
0.0645161, 0.0645161, 0.16129, 0.129032, 0.0322581, 0.0322581,
0., -0.0645161, -0.0645161, -0.0322581, 0.,
0., -0.0322581, -0.0645161, -0.129032, -0.193548, -0.225806, \
-0.290323, -0.258065, -0.225806, -0.258065, -0.258065, -0.322581, \
-0.354839, -0.322581, -0.354839, -0.387097, -0.419355, -0.451613, \
-0.451613, -0.419355, -0.419355, -0.483871, -0.516129, -0.516129, \
-0.516129, -1., -0.483871, -0.516129, -0.516129, -0.516129}, \
{0.516129, 0.516129, 0.516129, 0.516129, 0.516129, 0.483871, 0.419355,
0.354839, 0.322581, 0.322581, 0.290323, 0.290323, 0.322581,
0.322581, 0.290323, 0.258065, 0.225806, 0.16129, 0.129032, 0.129032,
0.0967742, 0.0645161, 0., -0.0322581,
0., -0.0645161, -0.0645161, -0.0645161, -0.0967742, -0.0967742, \
-0.129032, -0.16129, -0.129032, -0.0967742, -0.193548, -0.290323, \
-0.290323, -0.258065, -0.580645, -0.0645161, -0.258065, -0.290323, \
-0.322581, -0.258065, -0.225806, -0.322581, -0.387097, -0.419355, \
-0.354839, -0.322581, -0.354839, -0.387097, -0.451613, -0.419355, \
-0.419355, -0.451613, -0.451613, -0.483871, -0.483871, -0.483871, \
-0.516129, -0.516129, -0.516129}, {0.516129, 0.516129, 0.516129,
1.03226, 0.516129, 0.516129, 0.516129, 0.516129, 0.483871, 0.451613,
0.451613, 0.451613, 0.451613, 0.419355, 0.387097, 0.354839,
0.354839, 0.354839, 0.322581, 0.322581, 0.290323, 0.290323,
0.322581, 0.258065, 0.193548, 0.129032, 0.0967742, 0.0967742,
0.0645161, 0.0322581, 0.0322581, 0.0967742, 0.0967742, 0., 0.,
0., -0.0967742, -0.0967742, -0.0322581, -0.0322581, -0.0645161, \
-0.0967742, -0.0967742, -0.129032, -0.193548, -0.258065, -0.322581, \
-0.290323, -0.290323, -0.322581, -0.322581, -0.354839, -0.354839, \
-0.354839, -0.387097, -0.419355, -0.451613, -0.451613, -0.451613, \
-0.451613, -0.483871, -0.516129, -0.516129}, {0.516129, 0.516129,
0.516129, 0.516129, 0.516129, 0.483871, 0.451613, 0.451613,
0.419355, 0.387097, 0.354839, 0.322581, 0.290323, 0.258065,
0.225806, 0.16129, 0.16129, 0.129032, 0.0967742, 0.129032,
0.0967742, 0.0967742, 0.0645161, 0.0322581, 0.0322581,
0., -0.0645161, -0.0645161, -0.0322581, -0.129032, -0.225806, \
-0.225806, -0.16129, -0.419355,
0.0967742, -0.16129, -0.258065, -0.290323, -0.193548, -0.129032, \
-0.193548, -0.225806, -0.225806, -0.193548, -0.225806, -0.290323, \
-0.322581, -0.354839, -0.322581, -0.354839, -0.419355, -0.419355, \
-0.387097, -0.354839, -0.387097, -0.483871, -0.516129, -0.483871, \
-0.451613, -0.451613, -0.483871, -0.516129, -0.516129}, {0.516129,
0.516129, 0.516129, 0.516129, 0.516129, 0.516129, 0.483871,
0.451613, 0.419355, 0.387097, 0.387097, 0.354839, 0.322581,
0.258065, 0.225806, 0.193548, 0.16129, 0.16129, 0.16129, 0.225806,
0.225806, 0.16129, 0.129032, 0.0645161, 0.0322581, 0.0322581,
0.0322581, 0.0645161, 0.0322581, 0.,
0., -0.0967742, -0.16129, -0.129032, -0.16129, -0.16129, -0.193548,
\
-0.258065, -0.225806, -0.258065, -0.290323, -0.225806, -0.225806, \
-0.258065, -0.322581, -0.419355, -0.419355, -0.354839, -0.354839, \
-0.419355, -0.483871, -0.516129, -0.483871, -0.903226, -0.387097, \
-0.483871, -0.516129, -0.516129, -0.483871, -0.451613, -0.483871, \
-0.516129, -0.516129}}

```

• Prev by Date: Re: Unit testing using imported data
• Next by Date: Matrix typesetting question
• Previous by thread: import issue
• Next by thread: Re: This is nuts: Block[{u = 1}, g3[u]] and Block[{u = 0}, g3[u]] executes but NIntegrate[g3[u], {u, 0, Infinity}] doesn't execute