MathGroup Archive 2005

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

Search the Archive

Re: Hold[] ReleaseHold[] ? or what ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60201] Re: [mg60168] Hold[] ReleaseHold[] ? or what ?
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Wed, 7 Sep 2005 04:03:59 -0400 (EDT)
  • References: <200509060227.WAA25742@smc.vnet.net>
  • Reply-to: chris.chiasson at gmail.com
  • Sender: owner-wri-mathgroup at wolfram.com

In the second input, NIntegrate is called with an integrand that has
non numeric "constants of integration". In the first input, the
Pattern for the argument of f prevents that situation from occurring.

On 9/5/05, lupos <lupos at cheerful.com> wrote:
> hi all,
> 
> why does the following code work as hoped ?
> 
> In[1]
> fn[u_Real] := NIntegrate[Sin[x + u], {x, 1, 2}];
> FindMinimum[fn[u], {u, 0}]
> 
> Out[2]=
> {-0.9588510772084058, {u -> -3.070796346594197}}
> 
> 
> 
> but the next line generates some warnings/errors altough calculating
> correctly.
> how can the situation be fixed in a nice way ?
> maybe some Hold[] / ReleaseHold[] ?
> 
> In[3]:=
> FindMinimum[NIntegrate[Sin[x + u], {x, 1, 2}], {u, 0}]
> 
> Out[3]:=
> NIntegrate::inum : Integrand Sin[u+x] is not numerical at {x} = {1.5`}.
> NIntegrate::inum : Integrand Sin[u+x] is not numerical at {x} = {1.5`}.
> NIntegrate::inum : Integrand Sin[u+x] is not numerical at {x} = {1.5`}.
> {-0.958851077208406, {u -> -3.0707963268148295}}
> 
> 
> thanks for any hints
> robert.
> 
> 


-- 
Chris Chiasson
http://chrischiasson.com/
1 (810) 265-3161


  • Prev by Date: Re: Re: piecewise vs which
  • Next by Date: Re: Hold[] ReleaseHold[] ? or what ?
  • Previous by thread: Hold[] ReleaseHold[] ? or what ?
  • Next by thread: Re: Hold[] ReleaseHold[] ? or what ?