MathGroup Archive 2007

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

Search the Archive

Why is FindRoot[] HoldAll?

  • To: mathgroup at
  • Subject: [mg81957] Why is FindRoot[] HoldAll?
  • From: Szabolcs Horvát <szhorvat at>
  • 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?


  • Prev by Date: Re: How to remove an artifact from a plot
  • Next by Date: Re: Solution of a non-linear ODE
  • Previous by thread: Re: Why is FindRoot[] HoldAll?
  • Next by thread: Re: Why is FindRoot[] HoldAll?