Re: Why is FindRoot[] HoldAll?
- To: mathgroup at smc.vnet.net
- Subject: [mg81981] Re: [mg81957] Why is FindRoot[] HoldAll?
- From: "Szabolcs HorvÃt" <szhorvat at gmail.com>
- Date: Mon, 8 Oct 2007 00:07:24 -0400 (EDT)
- References: <200710070940.FAA20590@smc.vnet.net>
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
- References:
- Why is FindRoot[] HoldAll?
- From: Szabolcs Horvát <szhorvat@gmail.com>
- Why is FindRoot[] HoldAll?