MathGroup Archive 2002

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

Search the Archive

RE: FindRoot on fn with vble num of vbles

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36200] RE: [mg36164] FindRoot on fn with vble num of vbles
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Mon, 26 Aug 2002 04:16:30 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Try this:

Off[Remove::"rmnsm"]
Remove["Global`p@", "Global`p@@"]
n = 7;
pn = Unique["p"] & /@ Range[10]
f[p_] = Array[fk[p, #] &, n]
f[p]
fEq[p_] = MapThread[Equal, {f[p], Array[0 &, n]}]

Bobby Treat

-----Original Message-----
From: John MacCormick [mailto:jmac at tuzigoot.hpl.hp.com] 
To: mathgroup at smc.vnet.net
Subject: [mg36200] [mg36164] FindRoot on fn with vble num of vbles

Suppose f is a function of n real variables, and returns a
vector of n real variables.  What is the correct syntax to find a root
of f using FindRoot?

For instance, the following works with n=7, but I would need to change
the code if I changed the value of n:

f[p_] := Table[fk[p, k], {k,n}];

pn = {p1,p2,p3,p4,p5,p6,p7};

f1 := f[pn] [[1]];
f2 := f[pn] [[2]];
f3 := f[pn] [[3]];
f4 := f[pn] [[4]];
f5 := f[pn] [[5]];
f6 := f[pn] [[6]];
f7 := f[pn] [[7]];

theRoot = FindRoot[{f1==0,f2==0,f3==0,f4==0,f5==0,f6==0,f7==0}, 
                   {p1, 1/n},{p2, 1/n},{p3, 1/n},{p4, 1/n},{p5, 1/n},
                   {p6, 1/n},{p7, 1/n}];


-- 
			   John MacCormick
	 Systems Research Center, HP Labs, 1501 Page Mill Road,
 Palo Alto, CA 94304, USA.  Phone: +1 650 8572454, Fax: +1 650 8528186







  • Prev by Date: Re: Reducing a function to one argument
  • Next by Date: Re: Reducing a function to one argument
  • Previous by thread: FindRoot on fn with vble num of vbles
  • Next by thread: AW: "a[A_,B_] :=" Does not assign variables properly. Why?