Hold[] ReleaseHold[] ? or what ?
- To: mathgroup at smc.vnet.net
- Subject: [mg60168] Hold[] ReleaseHold[] ? or what ?
- From: "lupos" <lupos at cheerful.com>
- Date: Mon, 5 Sep 2005 22:27:25 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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.
- Follow-Ups:
- Re: Hold[] ReleaseHold[] ? or what ?
- From: Chris Chiasson <chris.chiasson@gmail.com>
- Re: Hold[] ReleaseHold[] ? or what ?