MathGroup Archive 2007

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

Search the Archive

Re: on a pure function for a list of integrals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77333] Re: on a pure function for a list of integrals
  • From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 7 Jun 2007 03:38:57 -0400 (EDT)
  • References: <f43gpj$2k7$1@smc.vnet.net> <4665D6FB.9070505@gmail.com>

On 6/6/07, Ruth <ruth.lazkoz at ehu.es> wrote:
> Thanks, Jean-Marc, you suggest
>
> f = Block[{x, a = #1, b = #2},
>          (NIntegrate[Sqrt[a*x + b], {x, 0, #1}] & ) /@ #3] & ;
> f[2, 3, {0.1, 0.5, 0.9}]
>
> but I think there are assignments which are never used as
>
> In[1]:= f = Block[{x},
>          (NIntegrate[Sqrt[a*x + b], {x, 0, #1}] & ) /@ #3] & ;
> f[2, 3, {0.1, 0.5, 0.9}]
>
> gives me exactly the same result so the bit a = #1, b = #2 seems unnecessary

How much do you bet on that :-)

In[1]:= f =
  Block[{x}, (NIntegrate[Sqrt[a*x + b], {x, 0, #1}] & ) /@ #3] & ;
f[2, 3, {0.1, 0.5, 0.9}]

During evaluation of In[1]:= NIntegrate::inumr:The integrand Sqrt[b+a \
x] has evaluated to non-numerical values for all sampling points in \
the region with boundaries {{0,0.1}}. >>

During evaluation of In[1]:= NIntegrate::inumr:The integrand Sqrt[b+a \
x] has evaluated to non-numerical values for all sampling points in \
the region with boundaries {{0,0.5}}. >>

During evaluation of In[1]:= NIntegrate::inumr:The integrand Sqrt[b+a \
x] has evaluated to non-numerical values for all sampling points in \
the region with boundaries {{0,0.9}}. >>

During evaluation of In[1]:= General::stop:Further output of \
NIntegrate::inumr will be suppressed during this calculation. >>

Out[2]= {NIntegrate[Sqrt[a*x + b], {x, 0, 0.1}],
 NIntegrate[Sqrt[a*x + b],
     {x, 0, 0.5}], NIntegrate[Sqrt[a*x + b], {x, 0, 0.9}]}

Regards,
Jean-Marc


  • Prev by Date: Re: Segregating the elements of a list based on given lower and
  • Next by Date: Re: apparently I don't know how to use Map (or Apply or MapThread)
  • Previous by thread: on a pure function for a list of integrals
  • Next by thread: Value of E