MathGroup Archive 2007

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

Search the Archive

Efficient repeated use of FindRoot

  • To: mathgroup at
  • Subject: [mg74049] Efficient repeated use of FindRoot
  • From: "Michael A. Gilchrist" <mikeg at>
  • Date: Wed, 7 Mar 2007 03:16:53 -0500 (EST)

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*)
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] *)
 	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.



Department of Ecology & Evolutionary Biology
569 Dabney Hall
University of Tennessee 
Knoxville, TN 37996-1610

phone:(865) 974-6453
fax:  (865) 974-6042


  • Prev by Date: Precision available with NIntegrate {Method -> Oscillatory}
  • Next by Date: Re: accessing a kernel on a network
  • Previous by thread: Re: Precision available with NIntegrate {Method -> Oscillatory}
  • Next by thread: Re: Efficient repeated use of FindRoot