Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Re: Iterative application of FindRoot with adjusted started values

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33022] Re: [mg33007] Re: Iterative application of FindRoot with adjusted started values
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Tue, 26 Feb 2002 04:35:07 -0500 (EST)
  • Organization: JEOL (USA) Ltd.
  • References: <a57hd0$2kb$1@smc.vnet.net> <200202250631.BAA09810@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

aes wrote:

> In article <a57hd0$2kb$1 at smc.vnet.net>,
>  steger at uni-greifswald.de (Thomas Steger) wrote:
>
> > I use Table[] together with FindRoot[] to repeatedly solve a system of
> > equations numerically. Now I would like to give the starting value for
> > the first calculation as prespecified while all subsequent starting
> > values should equal the n-1 th solution.
> >
> > Here is a simple example, where the starting value is fixed for all
> > calculations to follow.
> >
> > Clear[g1, g2]
> > g1 = a x + b y == c;
> > g2 = d x + e y == f;
> > Clear[a, b, c, d, e, f]
> > a = 0.5; b = 0.1; c = 2; d = 0.9; e = 1; f = .2;
> > Clear[a]
> > Table[FindRoot[{g1, g2}, {x, 4}, {y, -4}], {a, 0.5, 1, 0.1}]
>
> Me too.  More generally, I'd like to be able to use earlier ("already
> calculated"?) values in a table in calculating later values in the same table,
> e.g.
>
>    y = Table[ If[ k<2, k-1, a y[[k-1}] + b y[[k-2]] ], {k, 1, 5} ]
>
> but this doesn't work.
>
> [To handle things like this I resort to using a DO loop to calculate values of
> yTemp[k], then stuff these values into list y; but that's probably a naive --
> maybe even dumb? -- approach.]

You could do something like this:

y = {0,1,Block[{t1=0,t2=1,val},Sequence@@Table[val = a t1+b t2;t2 = t1;t1 =
val,{k,3,5}]}

There may be a more clever way of doing the assignments to avoid all the copies
but you get the idea.

Regards,

Sseziwa



  • Prev by Date: Re: sum problem with infinity
  • Next by Date: RE: sum problem with infinity
  • Previous by thread: Re: Iterative application of FindRoot with adjusted started values
  • Next by thread: Re: Iterative application of FindRoot with adjusted started values