Re: Efficient repeated use of FindRoot

• To: mathgroup at smc.vnet.net
• Subject: [mg74064] Re: [mg74049] Efficient repeated use of FindRoot
• From: "Chris Chiasson" <chris at chiasson.name>
• Date: Thu, 8 Mar 2007 04:37:14 -0500 (EST)
• References: <200703070816.DAA26723@smc.vnet.net>

```Whoops. I replied to the wrong thread with that last post.

On 3/7/07, Chris Chiasson <chris at chiasson.name> wrote:
> It is interesting that the result of Integrate on the
> InterpolatingFunction is just unevaluated (heh, after the smoke of a
> bunch of burning rule conditions clears) because the documentation for
> NIntegrateInterpolatingFunction specifically mentions the following:
>
> If you simply need to find the integral of an InterpolatingFunction
> object (as opposed to a function of one), it is better to use
> Integrate because this gives you the result which is exact for the
> polynomial approximation used in the InterpolatingFunction object.
>
> On 3/7/07, Michael A. Gilchrist <mikeg at utk.edu> wrote:
> > Hi all,
> >
> > I've got an optimization problem that I am trying to evaluate numerically
> > and at a number of different points of a particular variable.  I am using
> > a Lagrangian multiplier to impose a constraint on the optimization of the
> > 'free variables' and as a result trying to find the root for a set of n
> > coupled equations (in its full form n = 4000+ variables).
> >
> >
> > Using some approximations I can come up with some reasonable initial
> > conditions, but, as you might imagine, it takes quite some time to run
> > the code.  Looking at the output it appears that the greatest amount of
> > time is initialization of the FindRoot routine (once the routine is
> > running it calculates each step quite quickly).
> >
> >
> > Here's some pseudo code to illustrate the basic idea:
> >
> > (*set up eqns and variables*)
> > Clear[m];
> > vars = Table[m[i], {1, n}]
> >
> > eqns = Table[
> >         (llik[i, vars] + \[Lambda] m[i] ==0), {i, 2, n}]
> >                                 (*llik previously defined)
> > ics =   Table[
> >          m0[i] = T[i]/phi[i] (*T[i] and Phi[i] previously defined*),
> >         {i, 2, n}];
> >
> > frvars = Table[{m[i], m0[i] * 0.01, m0[i]*10}, {i, 2, n}];
> >
> >
> > (*look for solution to problem for multiple values of m[1] *)
> > Table[
> >         FindRoot[eqns, frvars], {m[1], 0.01, 0.2, 0.01}]
> >
> >
> > I am aware of the NDSolve package StateData that allows one to
> > efficiently evaluate DE's with various different initial
> > conditions by processing the equations.
> >
> > I've looked through the documentation on FindRoot and haven't found a
> > similar routine/ability.  I'm wondering if anyone has any ideas on how
> > one might increase the efficiency of my calculations.
> >
> > Thanks.
> >
> > Mike
> >
> >
> > -----------------------------------------------------
> > Department of Ecology & Evolutionary Biology
> > 569 Dabney Hall
> > University of Tennessee
> > Knoxville, TN 37996-1610
> >
> > phone:(865) 974-6453
> > fax:  (865) 974-6042
> >
> > web: http://eeb.bio.utk.edu/gilchrist.asp
> > -----------------------------------------------------
> >
> >
> >
>
>
> --
> http://chris.chiasson.name/
>

--
http://chris.chiasson.name/

```

• Prev by Date: Re: Efficient repeated use of FindRoot
• Next by Date: Re: Efficient repeated use of FindRoot
• Previous by thread: Re: Efficient repeated use of FindRoot
• Next by thread: Re: Efficient repeated use of FindRoot