Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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.


  • Prev by Date: ButtonEvaluator with two settings
  • Next by Date: Latex & Mathematica
  • Previous by thread: ButtonEvaluator with two settings
  • Next by thread: Re: Hold[] ReleaseHold[] ? or what ?