Why is FindRoot[] HoldAll?
- To: mathgroup at smc.vnet.net
- Subject: [mg81957] Why is FindRoot[] HoldAll?
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sun, 7 Oct 2007 05:40:46 -0400 (EDT)
Recently there was a question about finding the roots of an equation that is defined in terms of NIntegrate[]. The following *works*, but it gives lots of error messages: FindRoot[NIntegrate[Exp[a x], {x, 0, 1}] == 2, {a, 1}] The messages suggest that FindRoot evaluates the equation even before the unknown 'a' is substituted with a numerical value. This is not consistent with the fact that FindRoot has HoldAll. Would it be possible to 1. Either remove the attribute HoldAll to make it clear to the users how this function works (and allow FindRoot to receive Unevaluated arguments so that equations containing NIntegrate[] can be used directly), 2. Or prevent FindRoot from evaluating the equation before the unknown has been substituted with a numerical value. If either of these two possibilities is implementable in Mathematica, then IMO the current behaviour can be considered a bug. If they are not implementable, could someone explain why? -- Szabolcs
- Follow-Ups:
- Re: Why is FindRoot[] HoldAll?
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Why is FindRoot[] HoldAll?
- From: "Szabolcs HorvÃt" <szhorvat@gmail.com>
- Re: Why is FindRoot[] HoldAll?