MathGroup Archive 2007

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

Search the Archive

Re: Why is FindRoot[] HoldAll?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81983] Re: [mg81957] Why is FindRoot[] HoldAll?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 8 Oct 2007 00:08:25 -0400 (EDT)
  • References: <200710070940.FAA20590@smc.vnet.net> <0933C647-E891-4BF9-9038-96CF5C192798@mimuw.edu.pl> <f831b3d60710070440n5c15ea19s9225fa118c162969@mail.gmail.com>

On 7 Oct 2007, at 20:40, Szabolcs Horv=E1t wrote:

> On 10/7/07, Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
>> I am not sure from your message if you are aware of this:
>>
>> FindRoot[NIntegrate[Exp[a x], {x, 0, 1}] == 2, {a, 1}, Evaluated =
->
>> False]
>> {a -> 1.25643}
>>
>
> Thanks for the reply!  I did not know about this option.  It is a new
> option in Mathematica 6, but it seems to be undocumented (or at least
> I cannot find it anywhere in the documentation).
>
> These plotting functions accept this option too:
> {ContourPlot, ContourPlot3D, DensityPlot, FindRoot, ParametricPlot, \
> ParametricPlot3D, Plot, Plot3D, RegionPlot, RegionPlot3D}
>
> Most of them have the default setting Evaluated -> Automatic (which
> works with FindRoot too, though I have no idea how it decides whether
> to evaluate the argument or not).
>
>> No error messages. Of course, one would expect that using this option
>> will in most cases have a negative impact ton the performance.
>> Why the HoldAll attribute? Well, presumably without the HoldAll
>> attribute the function would always be evaluated irrespective of any
>> option settings so one could not use this approach. Not having the
>> HoldAll or HoldFirst argument means that it will always be evaluated,
>> before the function is applied. having it does not mean that the
>> argument will not be evaluated; it only means it will not be "pre-
>> evaluated". It may still be evaluated by the function itself.
>
> With the Evaluated option, it all makes sense.
>
>>
>> Andrzej Kozlowski
>
> Szabolcs

In version 5.* you could use:

Developer`SetSystemOptions["EvaluateNumericalFunctionArgument" -> False]

In Version 6 this still exists but seems to be overriden by the 
setting of the option "Evaluated".

Andrzej




  • Prev by Date: Re: Mathematica Numerical Integration and For Loop
  • Next by Date: Re: Why is FindRoot[] HoldAll?
  • Previous by thread: Re: Why is FindRoot[] HoldAll?
  • Next by thread: Re: Why is FindRoot[] HoldAll?